• I have created a menu I only want on a set number of pages, which are serving as a user guide. Because the web site itself isn’t very big, the user guide pages will take up the bulk of the site. Rather than use widget logic to show the widget/menu on the pages necessary, I thought it would be best to tell it which pages to NOT show it on, since there would be fewer of those.

    So.

    I set up an array, and it worked just fine. The widget/menu did not show on the pages. The problem is getting it to not show at all on the blog posts, either. Once I try to put in code for that, the widget doesn’t show up on any page, even the ones I want it to. Here are the things I’ve tried:

    !is_page(array(176,30,46,2,10,100,34,36,114,32)) || !is_page(‘blog’);

    !is_page(array(176,30,46,2,10,100,34,36,114,32)) || !is_page(‘home’);

    !is_page(array(176,30,46,2,10,100,34,36,114,32)) || !is_home();

    If I take away the semicolon, the widget/menu behaves correctly except it still shows up on the blog. Once I put the semicolon in, the widget/menu appears nowhere on the site, even though it should on some pages. The same thing happens once I include the || in the statement. I’ve tried additional variations. Basically, the array works great. It’s finding a way to also say “no widget on any part of the blog” where it ceases to function.

    The blog is not the front page. The front page is a static page, and the blog is set to a page called “news”, which is ID 25. I did try working with both the ID number in the array, and the use of the page name “news” as well, but with no luck. I also tried using a comma, &&, and including it in the array in its own parentheses.

    Please, if anyone could help me, I would really appreciate it.

Viewing 1 replies (of 1 total)
  • you want !(is_page(…) || is_page(‘blog’))

    that is, no semicolon (that’s making the statement invalid which amounts to the same as returning false, and you want everything ‘OR’d inside brackets with an ! (NOT) on the outside.

    i.e. NOT (A or B or C or D or page E)

    And according to http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page you should be able to use is_page(array(x,y,z)) where x y and z are mixes of page IDs, slugs etc

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Widget Logic] Want no widget on blog posts’ is closed to new replies.