Forums

Excluding sidebar items w/ conditional tags (5 posts)

  1. mattbramanti
    Member
    Posted 3 years ago #

    Ok, here's what I'm trying to do. On my homepage's sidebar, I've got a bunch of items. On individual posts, I'd like only a smaller subset of those items to be shown.

    I THINK I should use something like this

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>

    But it doesn't seem to be working. Any suggestions?

  2. eridan
    Member
    Posted 3 years ago #

    You could try with this, which should display stuff unless it's a single post page.

    <?php if(!is_single()) { ?>
    stuff
    <?php } ?>

  3. jonlandrum
    Member
    Posted 3 years ago #

    Actually, mattbramanti, that should work with no problems if implemented correctly. I was using the same tag, but I ended up with so many conditional tags that the sidebar loaded as long as a second after everything else. Since they were conditions of individual page templates, I simply put the whole sidebar content in those page templates, rather than calling the default sidebar. However, to answer your question, are you using the whole syntax, as eridan showed? For example, are you closing the argument with the <?php } ?> tag?

  4. mattbramanti
    Member
    Posted 3 years ago #

    Doh. I had a typo in the php close tag. Cripes, it's always something like that, you know? :)

    Anyway, thanks for all the help!

  5. jonlandrum
    Member
    Posted 3 years ago #

    :o) Figured it had to be something like that! Glad to see you got it working.

Topic Closed

This topic has been closed to new replies.

About this Topic