Greenguy's Board


Go Back   Greenguy's Board > Blogs and Blogging
Register FAQ Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 2007-05-09, 06:42 PM   #3
jayeff
Just because I don't care doesn't mean I don't understand!
 
jayeff's Avatar
 
Join Date: Sep 2006
Posts: 95
Send a message via ICQ to jayeff
The is_home function works very nicely in the sidebar. It used to work on pages themselves too and anyone looking around the codex is likely to find references to that functionality.

However, somewhere in the last couple of versions of WP, it stopped working except in the sidebar, so if anyone wants to do on a page, what you have done on your sidebar, the solution now is:
Code:
<?php if ($_SERVER['QUERY_STRING'] == '') { ?>
...whatever you want to display
<?php } ?>
This will identify your home page, because when you are on the home page, your address bar will read simply http://www.yourdomain.com/ or similar. That matches the empty query string condition. As you navigate around your site, even if you are displaying user-/se-friendly URL's, WordPress is actually translating the default ?=page6 or whatever. In other words the query string would not be empty.

With that knowledge and a little native cunning, you can adapt this code to put content on other specific pages too...
jayeff is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:33 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc