Widget Logic
Anyone know how to do the reverse of this logic? (3 posts)

  1. Nick Davis
    Posted 4 years ago #

    Hi guys

    Can anyone help tell me how I could do the reverse of the following logic (which successfully only displays a certain widget on certain pages)?

    global $post; return (in_array(1294,get_post_ancestors($post)) || (is_page('client-area')));

    However for the next widget I wanted to do exact opposite, as in hide the widget it on the same pages. My attempt to do this via !'s was:

    global $post; return (!in_array(1294,get_post_ancestors($post)) || (!is_page('client-area')));

    However although it doesn't return an error it doesn't hide the widget either. Any help very much appreciated.



    PS Love the Widget Logic plugin


  2. Submerged06
    Posted 4 years ago #

    Close, but I think this might work:

    global $post; return (!in_array(1294,get_post_ancestors($post)) && (!is_page('client-area')));

    The inverse of (A or B) is (!A and !B).

    This is 3 months late, I know, but maybe it'll help somehow still XD.

  3. Nick Davis
    Posted 4 years ago #

    Thanks Submerged, appreciate the answer, I'll give it a go

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic