hey there, I need to customize a few wordpress themes so that I can show the sidebar resource links ONLY on the homepage.. I managed to do it for one of my sites but can't figure my other themes out. here's the code I've been using: <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <li><a href="http://www.exampleurl.com/" target="_blank" >Example Anchor Text</a></li> <?php } ?> but when I post it under the text widget it still appears sitewide so I must be missing something.. any help would be muchly appreciated.. even willing to pay a few bucks <$20 for someone to help me with this across my blog network.. pm me for more details or if you have the answer quick post and ill help you out with some rep points or a free link off one of my sites..
Try this: <?php if ($_SERVER["REQUEST_URI"] == "/" || $_SERVER["REQUEST_URI"] == "/index.php") { ?> <li><a href="http://www.exampleurl.com/" target="_blank" >Example Anchor Text</a></li> <?php } ?> Code (markup): I use this on my Wordpress blogs, and it works great. I've used your code before, but that still shows ads on Page 2, Page 3, etc. (It does prevent the ads from showing up on actual post pages though) Hope this helps!
hmm.. thanks for that.. but doesnt seem to work with my theme when i put it in either the sidebar or under the text widget either.. any other suggestions?
Actually the use of is_front_page() may be a better idea: http://codex.wordpress.org/Conditional_Tags http://codex.wordpress.org/Function_Reference/is_front_page edit: And you need to tell us what "it doesn't work" means. Please provide us with a link or what you;re seeing. Specifics and details should be used on any forum. Please get into a good habit of doing so.
yeah.. I used the front page code for my other site and it worked, as for second point - it didn't work meaning it was still showing the link on all the pages, not just the homepage.. plus it's a different style formatting so I would prefer to have it in the sidebar.. <div class="sidebar_container"> <h2>Resources</h2> <ul> <?php wp_list_bookmarks('categorize=0&title_li='); ?> </ul> <div class="sidebar_bottom"></div> </div> <?php endif; ?> is an example of how the formatting & style of this specific theme.. doesn't seem to be a universal code that works across different themes .. so how would I change this one? I'm not a programmer so I have no idea... lol
Please provide us with a link or what you're seeing "it didn't work meaning it was still showing the link on all the pages, not just the homepage.. " is not specifics. It's a general statement. If you need us to look at the css formating, we need to be able to see the outputted code. Thanks
hah ok man... the site is http://www.home-improvement-tips.ca/ maybe just hit me up via PM might be easier