• Resolved lolopel

    (@lolopel)


    Hello, first post here!
    I’m working on a 4 page presentation WP. One of the first things I thought was that when on a specific page, my top menu would cover the other 3 pages. Therefore I created 4 pages in the backend (Home, About Me, News, Contact), would set their permalink to custom /%postname%/, would create 4 menus with links to the other 3 pages, 3 templates (apart from index.php) on root with the ‘page-“slug”.php’ (as page-about-me.php) structure as specified in each page’s backend interface and added 4 register_nav_menu functions to functions.php like this:

    function manny_theme_setup() {
    
    	add_theme_support('menus');
    
    	register_nav_menu('primary', 'Primary Header Navigation');
    	register_nav_menu('secondary', 'About Me Header Navigation'); 
    	register_nav_menu('third', 'News Header Navigation');
    	register_nav_menu('fourth', 'Contact Header Navigation');
    }
    
    add_action('init', 'manny_theme_setup');

    All registers are linked to the appropriate menu on the backend.
    Each template should be loading its own menu as they all start with their corresponding <?php wp_nav_menu(array(‘theme_location’==’primary’)); ?> with their (‘secondary’,’third’,’fourth’) references. Each template is loading their backend entries and posts correctly, but (AND HERE IS THE PROBLEM) they are all loading the first menu in the backend menu list, which happens to be (because of alphabetical matters I guess) ‘About Me Navigation’ and that won’t change doesn’t matter if I exchange the ‘theme_location’ reference on each one of them. Moreover, I know that Home page (which is set as Front page) loads index.php, Contact page loads page-contact.php, About Me page loads page-about-me.php, but News page (Which is set as Posts page) isn’t loading page-news.php, it’s falling back to index.php.

    I would dearly accept some guidance, I don’t want to advance too much without solving this issue cause I think it’ll bring me further problems. Please mind that my WP is located in a /wordpress subfolder inside my domain.

Viewing 1 replies (of 1 total)
  • Thread Starter lolopel

    (@lolopel)

    Ok it was as simple as <?php wp_nav_menu(array(‘theme_location’=>’primary’)); ?>, instead of “==”. Although Post page’s template still falls back to index.php.

Viewing 1 replies (of 1 total)

The topic ‘Custom menus & templates not loading properly.’ is closed to new replies.