• I’m using a theme where there are tabs across the top, listing the pages I’ve created. I’d like to exclude the “Contact Us” link from those tabs and have it just in the sidebar. If I exclude page IDs in the Pages widget, that of course takes it out of the sidebar, which is the opposite of what I want. Where in the code do I need to look?

    Here’s the template in question: https://upmichigan.biz/

Viewing 10 replies - 1 through 10 (of 10 total)
  • I just took a look at the theme you are using. It appears there is a theme options panel that includes the ability to exclude pages from the top Nav. Look under the Appearances options and see if you can find it.

    If not you can exclude it with a plugin like this one.
    https://www.technokinetics.com/plugins/page-lists-plus/

    Thread Starter BunnyB

    (@bunnyb)

    Thanks for replying. I can’t find anything like that, other than the Pages widget, where I can exclude them from the sidebar. I don’t see a Theme Options Panel or anything similar.

    I will check out the plugin further but I have a feeling it is specific to sidebars, not tab situations, which I suppose are different in every theme. I could be wrong!

    Hi

    That plugin works with wp_list_pages, wherever it is. It works because you are going to specify on the page while you are editing it that you don’t want that page being included when wp_list_pages runs. In fact a problem might be that it would also not include it in the sidebar as well as the top nav. You will have to try it to see whether that is true.

    Find the wp_list_pages function in your template files, it is probably in header.php.

    Add an exclude parameter to the function, like this

    <?php wp_list_pages('exclude=17,38' ); ?>

    Replace the ‘17,38’ with the ID numbers of the pages that you don’t want to show.

    Her theme doesn’t use a wp_list_pages in header.php, that is the whole issue.

    Yes, it does. It’s just not in header.php.

    header.php calls a function called art_menu_items

    art_menu_items is defined in functions.php in the template.

    That is where you would need to change it to exclude certain pages, I’ll have a deeper look later, and see the best way to do it.

    Thread Starter BunnyB

    (@bunnyb)

    Forgive me, but wouldn’t these suggestions just remove it from the Pages widget in the sidebar? Would it still appear in the navigation tab on top?

    Thread Starter BunnyB

    (@bunnyb)

    Okay, I found this code in the functions.php file:

    if (null === $isHomeSelected)
    		$isHomeSelected = is_home();
        if (true === $showHomeMenuItem)
    	echo '<li><a' . ($isHomeSelected ? ' class="active"' : '') . ' href="' . get_option('home') . '"><span><span>'
    		. $homeMenuItemCaption . '</span></span></a></li>';
    	add_action('get_pages', 'art_header_page_list_filter');
    	add_action('wp_list_pages', 'art_list_pages_filter');
    	wp_list_pages('title_li=');
    	remove_action('wp_list_pages', 'art_list_pages_filter');
    	remove_action('get_pages', 'art_header_page_list_filter');
    }

    Here’s the number of the page I want to exclude: wp_list_pages('exclude=21');

    Where would I put that?

    Thread Starter BunnyB

    (@bunnyb)

    Just bumping this in hopes of a helping hand!

    Thread Starter BunnyB

    (@bunnyb)

    I finally found the answer. I replaced
    wp_list_pages('title_li=');
    with
    wp_list_pages('title_li=&depth=3&sort_column=menu_ order&exclude=21');

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Excluding pages from tabs’ is closed to new replies.