Widget Logic
[resolved] Conditional Statement for Multiple Page Templates? (6 posts)

  1. Mike
    Posted 5 years ago #

    In Widget-Logic, I can use a conditional statement for a particular widget to display if it is not a given page template. Example:

    However, it doesn't seem to work if I specify multiple templates. Example:
    !is_page_template( array('pagetemplate-this.php','pagetemplate-that.php','pagetemplate-other.php'))

    What am I doing wrong?


  2. Michael
    Forum Moderator
    Posted 5 years ago #

    is_page_template() does not take an array as argument.


    !is_page_template('pagetemplate-this.php') && !is_page_template('pagetemplate-that.php') && !is_page_template('pagetemplate-other.php')


  3. Mike
    Posted 5 years ago #

    Awesome, that worked! I had read somewhere to put double-pipe charachers *||* where you have the ampersands. That did not work, but the ampersands did! THANK YOU!

  4. Michael
    Forum Moderator
    Posted 5 years ago #

    check up general on BOOLEAN ALGEBRA http://en.wikipedia.org/wiki/Boolean_algebra_(logic)

    || stands for OR and you can't by logic not combine negated results this way.

    && stands for AND which in your case makes sure that all three nagated conditions have to be met at the same time.

  5. Mike
    Posted 5 years ago #

    Ah, makes sense. Thanks again!

  6. Mike
    Posted 5 years ago #

    I guess I should have looked in the "Other Notes". In case it helps someone else, good explanations here: http://wordpress.org/extend/plugins/widget-logic/other_notes/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic