Support » Fixing WordPress » Conditional tags

  • I have tried to use conditional tags in my sidebar.php to show certain content for certain pages

    <li><?php /* If this is the frontpage */ if ( is_home() ) { ?>
    <h2><?php _e('Om'); ?></h2>
    <p class="test">V&auml;lkommen till <strike>v&aring;r</strike> Gustafs lekstuga p&aring; webben.
    H&auml;r hittar Tobias och Toves sl&auml;ktingar och v&auml;nner i n&auml;r och fj&auml;rran
    bilder s&aring; de kan f&ouml;lja med i vad som h&auml;nder i Tobias och Toves liv.
    <?php } ?>

    <li><?php /* If this is the Arkiv */ if ( is_page(42) ) { ?>
    <h2><?php _e('Om arkiven'); ?></h2>
    <p class="test">H&auml;r kan du leta i v&aring;rt arkiv f&ouml;r att hitta exakt vad du s&ouml;ker.
    Arkiven &auml;r sorterad &aring;rs- och m&aring;nadsvis. Du kan &auml;ven g&aring; igenom alla nyheterna baserade p&aring; vilken kategori de har sorterats in under.
    <?php } ?>


    In my sidebar I have used this approach set up conditional tags för för 6 pages.

    My idea was to use the tags to show a description based on the page the visitor was viewing.

    In Firefox and Safari this aproach works fine. In Interner Explorer, however, the right content in the sidebar is shown but the design is messed up. It seems as Internet Explorer leaves a blank space för the conditional tags that are not shown.

    Any suggestions on how to solve this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m not sure, but maybe the conditional tag should come before the list tag, instead of being inside it.

    <?php /* If this is the Arkiv */ if ( is_page(42) ) { ?>


    <?php } ?>

    You are a genious!!! It worked. Thanks for your help

    I got a quite similar problem:
    When I use <?php if ( is_home() ) { ?> to have a different formatting for the individual posts, my sidebar in which the conditional tag is used shows double when is_home is filled, but only in Internet Explorer.

    Any suggestions? 😉

    The site is

    Thanks for your help!

    pcmt, the code you have posted seems to the one I was looking for. But, I am a newbie can you put the code little detailed?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional tags’ is closed to new replies.