WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Widget Logic] Condition for front page and single posts NOT working? (7 posts)

  1. CrazySerb
    Member
    Posted 4 years ago #

    I have this defined in widget-logic:

    !(is_front_page() || is_single())

    to hide the widget from front page and all posts, and it's not working.

    heck, even putting !is_single() alone doesn't work for posts.

    what gives?

    what am I missing here?

  2. s_ha_dum
    Member
    Posted 4 years ago #

    Are you wrapping the code you want to exclude with curly braces like this:

    <blockquote>
    if (!is_front_page() || !is_single()) {
      // stuff to exclude
    }</blockquote>

    Plus, you need to make that a valid if statement. Notice the changes I made.

  3. CrazySerb
    Member
    Posted 4 years ago #

    this is for widget-logic plugin, so that answer doesn't apply, really... but thanks.

  4. s_ha_dum
    Member
    Posted 4 years ago #

    Oops! Yep, you're right. Sorry.

    You are hiding from the front page and from all posts, can you instead use is_page() to get what you want?

  5. alanft
    Member
    Posted 4 years ago #

    crazyzerb, your logic code seems good to me. try the troubleshooting steps on

    http://wordpress.org/extend/plugins/widget-logic/faq/

  6. CrazySerb
    Member
    Posted 4 years ago #

    Weird, that didn't help...

    Even setting it to:

    !(is_home() || is_single())

    does absolutely nothing for that widget... and its state depends on the widget above it, somehow, in a weird way.

    if I set the widget above it to

    !(is_home() || is_single())

    as well, everything works fine.

    But if I set the widget above it to

    !(is_home())

    alone, nah, the problematic widget shows up as well.

    Even with the wp_reset_query fix....

    You think it's the theme coding and its custom widgets?

  7. alanft
    Member
    Posted 4 years ago #

    could possibly be the custom widgets that you are using. try a basic set up - the default theme with a couple of basic widgets, like the built in text widgets

Topic Closed

This topic has been closed to new replies.

About this Topic