Support » Themes and Templates » New Pages Automatically Added to Nav Bar – HELP!

  • Resolved jakecollier

    (@jakecollier)


    Hey, guys. I’m using the cp-minimalist theme (with a Child Theme, of course), and have noticed that every time I add a new page, it’s automatically added to the top nav bar of the site. Not good, since I’d like to have more than just 5 or 6 pages here.

    I am no code monkey, so do any of you guys have any ideas for me? Still learning (well, I guess we all are, long as we have a pulse).

    To be honest, I don’t even know where to begin finding the snippet of code that may help. Really hoping to not change themes, since I like the simplicity of this one.

    Thoughts?

    http://screenshotromance.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • jakecollier

    (@jakecollier)

    Oh, and just a bit more clarification…

    I like the way the top nav looks. I’d just like to be able to control what goes up there and what doesn’t.

    I’ve never used that theme but it looks like it’s just using wp_list_pages for the top menu.

    Since you are already using a child theme I’m assuming you know at least a bit of code.

    Look in header.php in the child theme for

    wp_list_pages('title_li=');

    Replace that with

    wp_list_pages('include=1,2,3&title_li=');

    Change 1,2,3 to the ID of the pages you want to include in the menu.

    That should give you what you want.

    jakecollier

    (@jakecollier)

    I believe that’s going to work perfectly, Ming Sheu.

    One further question – for keywords’ sake, I’d like to have a page displayed in the nav with a different title than the actual name of the page.

    For instance, a page is titled “How To Take a Screenshot” (a keyword I want to keep in the page title), but I’d rather the nav title be something shorter, like “Screenshot?” or “How To”. Is there a “list as” tag I can use?

    Don’t want to abuse your knowledge. That’s my only further question. Thanks for your help.

    If you want that level of control, I would recommend swapping out the wp_list_pages code with the following.

    register_nav_menu or register_nav_menus

    You would put the register_nav_menu(s) in your child theme functions.php file.

    wp_nav_menu

    Once registered, you would call wp_nav_menu in header.php

    To configure what and how items are displayed, go to Admin -> Appearance -> Menus

    jakecollier

    (@jakecollier)

    Thanks, Ming Sheu. You’ve been an enormous help. I’m smarter now than I was before this thread began. 🙂

    Sure, no problem.

    I don’t know your skill level so hopefully the reference links are good enough to get you started.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘New Pages Automatically Added to Nav Bar – HELP!’ is closed to new replies.