Viewing 12 replies - 16 through 27 (of 27 total)
  • Were you off during the weekend?

    What do you mean by that? Are the ways I listed above not working for you?

    Thread Starter ezgold

    (@ezgold)

    Mercime, I didn’t see your suggestion when I wrote the last comment.

    Unfortunately your suggestion didn’t help since when I remove the <?php art_menu_items(); ?> The top-menu buttons disappear and all I see is links (you can see the button now – I changed it back to how it was).
    https://searchbyssn.org

    I did add the exclude pages and I can control the side bar and the top menu. But I still can’t control them separately. I want the top menu to have certain links(buttons) and the side bar to have different links.

    If you want different links in the two menus, then I don’t think either Exclude Pages or Page Lists Plus will get you there.

    To specify which pages appear in your top menu without losing the button states, try replacing the <?php art_menu_items(); ?> function call in your header.php theme file with this:

    <?php
    $page_list = wp_list_pages('title_li=&sort_column=menu_order&echo=0&include=1,2,3');
    $page_list = preg_replace('<code><a(.+)</a></code>', '<a$1</span></span></a>', $page_list);
    $page_list = preg_replace('<code><a(.+)&quot;></code>', '<a$1"><span><span>', $page_list);
    echo $page_list;
    ?>

    Replace “1,2,3” with a comma-separated list of the IDs of the pages that you’d like to include there.

    For your sidebar, this should do if you want to specify which pages do appear there:

    <?php wp_list_pages(title_li=&sort_column=menu_order&include=1,2,3); ?>

    Alternatively, use this to specify which pages don’t appear there:

    <?php wp_list_pages(title_li=&sort_column=menu_order&exclude=1,2,3); ?>

    Hope that works. Let us know how you get on.

    – Tim

    One slight problem with the code above: Where you see code tags replace them with a backticks (a bit like a single quote, usually on the key to the left of the 1 key).

    – Tim

    Thread Starter ezgold

    (@ezgold)

    do you mean replace with ` ?

    Where do I place the code for the sidebar? in the sidebar.php?

    Thread Starter ezgold

    (@ezgold)

    do you mean replace with ` ?

    do you mean that I need to replace <code> with `?

    Yes, replace <code> / </code> with backticks.

    And your sidebar menu code will probably be in your sidebar.php theme file (but you’ll need to take a different approach if you’re using a dynamic sidebar/widgets).

    – Tim

    Thread Starter ezgold

    (@ezgold)

    I tried the code you gave me and I got an error:
    Parse error: syntax error, unexpected $end in…./html/searchbyssn.org/wp-content/themes/pigskin/header.php on line 56

    Will this code let me keep the “home” button in the top menu as well?

    Posting code can be a little tricky here (as you can see from the broken thread layout). If you email me your header.php theme file at tim @ technokinetics.com then I’ll email it back with the code in place.

    – Tim

    Thread Starter ezgold

    (@ezgold)

    Tim helped me solve it!

    Thank you!

    I was trying to remove certain links from my header menu, and from my pages sidebar menu. With a combination of the wp-list-pages, exclude and the Pages List Plus plugin, I have finally got my menus all working exactly as I wanted them. This has been the bane of my life for months now. Thank you so much for all the help listed above!

    I had the same issue as ezgold. I wanted to set a static page for my blog and not have it show as Home twice in the top navigation menu. My header called the menu with:
    <?php art_menu_items(); ?>

    With the information above, I found the call in the functions.php file

    . $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');

    I changed the following line to exclude the new Home page and it is now working fine.
    wp_list_pages('title_li=&exclude=3');

    Hope that helps someone down the road.

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Page titles automatically added to menu’ is closed to new replies.