Conditional Tags for Sidebar Content
-
Hello, I’m trying to learn how to use conditional tags in
areas such as sidebar.php so that I can have dynamic content there
such as a calendar widget, and fun facts widget on the home page and
no where else.I looked into codex and am trying to make this work, but I’m missing something I think.
<?php if ( is_home() ) { // add calendar widget to home page echo do_shortcode('[my_calendar format="mini" showkey="no"]'); } else {} ?>
I got this one to work fine except obviously the title still shows on every page.
<div class="fun-facts-widget"><div id="fun-facts-widget-title">Fun Facts</div><?php if ( is_front_page() ){ if (function_exists (news_announcement)) news_announcement(); }?></div>
I can’t figure out how to use the conditional tag while keeping the content wrapped in divs for styling and any extra markup like headlines, etc.
I just need a little assistance and I can be on my way I think. I’d appreciate any tips I can get. Still learning this stuff.
- The topic ‘Conditional Tags for Sidebar Content’ is closed to new replies.