Forums

[resolved] Conditional tags, exclude only the home page, Widget Logic (10 posts)

  1. Mandipdx
    Member
    Posted 11 months ago #

    I am using the plugin Widget Logic that uses conditional tags. I have figured everything out except how to have the posts display on all pages except the static home page.

    What is the conditional tag to display the widget on all pages or posts except the home page?

    Thanks so much!

  2. Jonas Grumby
    Member
    Posted 11 months ago #

    Usually for a static home page it's if is_front_page()

    I have never used that widget so I don't know what it accepts.

  3. Mandipdx
    Member
    Posted 11 months ago #

    I want to exclude just this page. Include all others.

    Thanks.

  4. Jonas Grumby
    Member
    Posted 11 months ago #

    So you say if it's the home page do nothing, else display the widget. Will that work? I don't know the widget because I write my own conditional code.

  5. alchymyth
    The Sweeper
    Posted 11 months ago #

    try:

    !is_front_page()

    ! is the php logic negation operator

    http://codex.wordpress.org/Conditional_Tags

  6. Mandipdx
    Member
    Posted 11 months ago #

    Can I just tell you how much you guys rock! THANK YOU so much!

    the: !is_front_page() worked wonderfully!

  7. Jonas Grumby
    Member
    Posted 11 months ago #

    Good to know. Thanks!

  8. gravesend47
    Member
    Posted 10 months ago #

    I am having a similar problem.

    If I use !is_front_page() on a widget it works fine.

    However, I'm struggling to make a widget show in just one or two categories, but not on the front page.

    My syntax may be wrong as I'm new to this as I had

    !is_front_page() || in_category( '23' )

    While this works for the category, it still shows on the front page.

    Any ideas? Thanks!

  9. alchymyth
    The Sweeper
    Posted 10 months ago #

    make a widget show in just one or two categories

    are you referring to category archive pages? or single posts with this category?

    for category archive pages, try and use is_category( '23' ); in this case, you should not include the check for the front page.

    for single posts with this category, you could use is_single() && in_category( '23' )

    this combination !is_front_page() || in_category( '23' ) does not make sense.

    http://codex.wordpress.org/Function_Reference/is_category
    http://codex.wordpress.org/Function_Reference/in_category

    http://php.net/manual/en/language.operators.logical.php

  10. gravesend47
    Member
    Posted 10 months ago #

    Thanks alchymyth! The second one of those worked just fine.

    I did have a similar version of that working before, but for some reason it stopped working (or I did something to make it stop!).

Reply

You must log in to post.

About this Topic