WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
excluding home page (9 posts)

  1. Oazar
    Member
    Posted 1 year ago #

    Hello

    I am using this widget on a website to display a widget in some categories and it works fine.
    I just have a problem with the homepage : the widget appears on the homepage if a post of the category where it is supposed to appear, has just been published, as the post is then on the homepage.

    I don't want the widget to appear on home page, never, whatever posts are displayed on homepage. may you help me ?

    Thanks

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

  2. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    This is from http://wordpress.org/extend/plugins/widget-logic/faq/ "Widgets appear when they shouldn't"

    your logic for the widget that is appearing when it shouldn't probably has something like in_category(x) and it needs to be is_single() && in_category(x)

  3. Oazar
    Member
    Posted 1 year ago #

    All right, I tried to do things like that. But what I need is the widget to appear if I am in the category page as well as on a post page.
    So I must be very clumsy, but I cannot find the good way to write it.

    what I iould need is a way to say : "never on homepage"... it doesn't exist ?

  4. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    Check http://wordpress.org/extend/plugins/widget-logic/faq/ "How do I get a widget to appear both on a category page and on single posts within that category?"

  5. Oazar
    Member
    Posted 1 year ago #

    Thanks for your help, but I already have the widget appearing both in category AND post.
    I just want to prevent it displaying on home page.

  6. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    what's the logic you are using?

  7. Oazar
    Member
    Posted 1 year ago #

    This is what I wrote, which is efficient. The widget appears when it should.

    My only problem concerns the homepage : I need a way to prevent the widget to dispolay on the homepage, whatever posts are displayed on this page.

    in_category('Prochainement')||is_category('Cinéma')||in_category('Cinéma')||is_category('Prochainement')||in_category('Spectacles')||is_category('Spectacles')||in_category('Espace Jean Vilar')||is_category('Espace Jean Vilar') || in_category('Galerie Julio Gonzalez') || is_category('Galerie Julio Gonzalez') || is_category('Université Populaire d\'Arcueil') || in_category('Université Populaire d\'Arcueil')||in_category('Médiathèque')||is_category('Médiathèque')||in_category('Pratiquer')||is_category('Pratiquer')||in_category('Artistes')||is_category('Artistes')

  8. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    all of the instances of in_category(...) need to be (is_single() && in_category(...))

  9. Oazar
    Member
    Posted 1 year ago #

    All right !

    thanks so much alanft, I'll try this !

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags