Re: Really Simple – Adding Link to theme – Need Help
Hey kennibc-
I’m glad jjj got you down the path.
I assume you’re placing this code in the header.php file. The reason that you need to set $bp as global is that without it, a call to the $bp object is out of scope–it has no way to reference the object’s fields.
Here’s another way to accomplish your clickable image links. This way pulls in the user’s name and not the user’s id.
<?php global $bp; ?>
<a href="<?php echo bp_core_get_userurl($bp->loggedin_user->id); ?>blogs/create-a-blog" title="hi" ><img src="<?php bloginfo('template_url'); ?>/images/createblog.png" alt="Create a Blog" /></a>
Two final notes:
First, I removed the hspace=”4″ align=”right” attributes from the image tag. You don’t need them. Instead, position the images using CSS.
Second, I included the title tag within the anchor tag. Replace the text with whatever you want it to say. Although it is a matter of choice among coders, in my opinion it is wise to make a practice of using the title tag. It is an accessibility aid on links and it allows browsers to pop up a nice tooltip when a user positions their browser over an image.