Jump to content

Wordpress: Help w/ "if/then" statement for excluding nav items on specific pgs


Recommended Posts

 

 

I need to create a couple of pages with limited navigation items for a friend's website. I'm thinking what I need to do is use if is_page to create additional exclusions on the pages in question. I'm a PHP newb and not sure how to handle the syntax though.

 

Here's the sandbox_glovalnav section from the site as it is now:

 

I think if I do an if page_is statement with the snipped below used for both the "if" part of the statement and the "then" part of the statement, with the additional pages that need to be excluded, it'd do the trick. Just don't quite know how and don't want to break my friend's site.

 

function sandbox_globalnav() {

if ( $menu = str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages('title_li=&sort_column=menu_order&echo=0&exclude=254,271,274,277,279,465,454,486,545,650,816,831,904,910,946') ) )

 

$menu = '

 

      ' . $menu . '

 

';

$menu = '<div class="menu">' . $menu . "</div>\n";

echo apply_filters( 'globalnav_menu', $menu ); // Filter to override default globalnav: globalnav_menu

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.