WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Conditional tags (4 posts)

  1. Sam-30
    Member
    Posted 1 year ago #

    I use a plugin to show widgets on a page or post I want and don't want.
    (widget logic)

    I have done some reseach about conditional tags, and I now a little now.
    But got 2 questions.

    The following tag:
    is_single ( array (43842,43846, 43849) ) && in_category( '388' )
    This tag shows a widget in 3 posts of 1 categorie.

    - What do I have to change when I don't want to show te widget in that 3 posts, so it shows anywhere accept those 3 posts?

    - And what if I have also 2 other posts in a other categorie?

    Cheers,
    Sam

  2. nofearinc
    Member
    Posted 1 year ago #

    I'm not really a user of the plugin, but you might try:

    ! ( is_single ( array ( 43842, 43846, 34849 ) ) ) && in_category( 388 )

    for the first case, and for the second one:

    ( is_single ( array ( 43842,43846, 43849 ) ) && in_category( 388 ) ) || ( is_single ( array (33333, 23456 ) ) && in_category( 342 ) )

  3. Sam-30
    Member
    Posted 1 year ago #

    ! ( is_single ( array ( 43842, 43846, 34849 ) ) ) && in_category( 388 )
    Does not work, it disapear everywhere.
    Does ! mean don't show?
    Any one now how I can get the tag right?
    I want to show a widget everywhere on the website, only not in the 3 posts.

    ( is_single ( array ( 43842,43846, 43849 ) ) && in_category( 388 ) ) || ( is_single ( array (33333, 23456 ) ) && in_category( 342 ) )
    That works fine! Thanks a lot!

  4. Sam-30
    Member
    Posted 1 year ago #

    It is solved!

    The tag is ! is_single ( array ( 43842, 43846, 34849 ) ) && in_category( 388 )

    And I had another plugin for logic and I don't think they were matching together.

    It works great now and can do a lot now!
    THANKS

Topic Closed

This topic has been closed to new replies.

About this Topic