Custom menus in my self written templates
-
Hi
I have been successfully building templates for WP and customising them, and so far all functions are working very well. In fact they seem to work seamlessly. I have just had a request from a client for custom menus. What they want is what is basically built into WP now, which is the possibility of having the top menu show the main pages and a secondary menu to show other sub pages site wide. I have implemented this in the site (s) in question. They work fine but there is a problem I can’t seem to solve.
To explain more clearly. I have made two custom menus in the dashboard. The horizontal top menu is the main menu while a vertical menu, to go in the sidebar is arranged to show some sub pages. For example in this case I have an arrangement like this
1. Collections (the main page link)
1a. Pret-a-poerter
1a1. page of this season
1a2. page of the new collection
1b. Platinum
1b1. page of this season
1b2. page of the new collection
1c. AccessoriesNow my normal requirement would be for this sidebar menu to show 1. 1a 1b and 1c when they first see it. Then on clicking the link in each case to see the subpages below that. Yet on my site this does not happen!
The function for allowing two custom menus exists in my functions.php in the template. As below:
if (function_exists(‘register_nav_menus’)) {
register_nav_menus(
array(
‘primary-menu’ => __( ‘Primary Menu’, THEME_NS),
‘secondary-menu’ => __( ‘Secondary Menu’, THEME_NS)
)
);
}Perhaps I should note that I build the code base in Artisteer and then modify and customise according to requirement per individual site.
As I say everything works fine aside from this function and I can not figure out why this is happening. (reference: https://flux.badmathematics.com/fani-test/main/ this is the site in question).
I have read the how to on WP site but I don’t quite understand where I need to mod my functions.php to make this work correctly!Please help!
Thanks VM
- The topic ‘Custom menus in my self written templates’ is closed to new replies.