free hit counters
If you are using Internet Explorer as your browser please be running at least IE 7 or above. This site does not support IE 6 or below. Go here for the latest free version including easy download and installation instructions If you want to make it real easy on yourself, download Firefox , the most popular browser in the world. It's free and simple. You'll be so glad you did.
Jan
15
2009

Remove an avatar from selected pages

Check out the tutorial on placing avatars next to a post or page title here. When you do this you’ll get an avatar on every single page you have.  Say you want to take the avatar off certain pages.  Take the code you have from the function you already created and add the following code in red…

/*removing an avatar from selected pages*/
function author_avatar() {
if (!is_page(304) && !is_page(173))
echo ‘<img src=”http://www.thesishacker.com/wp-content/themes/thesis/custom/images/nastycanasta.jpg” class=”title-avatar” />’;
}
add_action(’thesis_hook_before_headline’, ‘author_avatar’);

Basically you’re taking a simple if (is_page()) statement and adding…

An exlamation point, !, which in PHP makes whatever is in front of it, negative.  What you’re doing is saying “if the page isn’t ()”

In the () you put whatever page id you want.  You find the page id by going to the page you want and in the address bar it’s the last number in the address.  If you go to the tutorial page in this site the URL is ..

http://www.thesishacker.com/?page_id=173

The page id is 173, thus that’s the number I put in the function

Also you need 2 “&” together to say “and” in PHP.  I decided to negate two pages, thus I needed the && between the two identifiers

Leaving a comment with code in it...

If you would like to leave a comment and you have examples of code you want to show, you must "escape the code". This allows the entire code to show correctly by inserting certain variable around certain tags to make them show. If you don't "escape the code" your code will show up broken, mangled, and it won't be able to be seen correctly. "Escaping the code" is very simple...

  1. Copy your code you want to show
  2. Click here to go to the site to escape the code
  3. Follow the directions, it's so easy
  4. Once you have the escaped code copied, paste it in the comments area where you want
  5. Now you can enjoy life


Go ahead, leave a comment...

Leave a Comment

Previous post: Rotating random text on every post or page

Next post: Where to find your custom.css file