• 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 vondewall.com'); ?></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.
    </li>
    <?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.
    </li>
    <?php } ?>

    etc

    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) ) { ?>

    List…

    <?php } ?>

    Thread Starter dewall

    (@dewall)

    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 https://www.nachtjournal.com

    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?
    Thanks.

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