I am having an issue with a menu in WordPress. For some reason when I display a category-members.php page that pulls a custom post type the WordPress menu disappears.
Please view the page here: [[LINK href="http://visitprineville.org/category/members/"]]http://visitprineville.org/category/members/[[/LINK]]
Notice that every other page on the site has the menu. Any ideas?
Julio Potier answers:
Hello
In your theme you got a special code for category request and it seams that the menu is not included here.
I can have a lot via FTP or admin account if you want.
See you soon !
Auz Clement comments:
Hi, I have set you up with an admin account. Let me know if you have any luck! Thanks!
Julio Potier comments:
Ok, the problem comes from the wp_nav_menu() function.
header.php : <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'fallback_cb' => 'digi_no_nav' ) ); ?>
In the theme we got 3 menu locations and 2 menus.
Location 1 : Header (primary) with menu "Header" inside.
On every page, this menu works, but on category pages : it does not.
I tried to modify the permalink settingd, nope ...
i tried to include another menu (footer), nope ...
I tried to modify theme_template, nope ...
Same with fallback,
i also tried to add the menu_id=4, nope ...
the final <ul> is stillf empty.
if i delete theme_template, nope, a red banner from wordpress ask me to add a new menu.
I can not guess WTF with this function menu ! ><
Auz Clement comments:
I also tried adding another menu and placing into the third menu location, but that did nothing.
Can't figure this one out...
Julio Potier comments:
Yeah ! It works !
Here comes the new code for the wp_nav_menu for your theme :
<?php
$backup_query = $wp_query;
$wp_query = new WP_Query(array('post_type' => 'post'));
wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'fallback_cb' => 'digi_no_nav' ) );
$wp_query = $backup_query;
?>
The "reset" of wp_query seems to be the only solution ;)
Done ! :)
Julian Lannigan answers:
The HTML for the menu is not being constructed on that page. Could you send over the template file that is running that page?
Kannan C answers:
Seems like you are using super fish drop down plugin. Have you included any ids in the widget to exclude any pages? or there are any conditional code in your header widget area? showing your header.php code will be help me to find the error.
Auz Clement comments:
Hi, I posted the header.php code. Let me know if you have any ideas. Thanks!
Abdessamad Idrissi answers:
Hey Auz,
it disapears because you forgot to style it! if you notice that the category members is concidered as an "archive" that's why the menu is disappearing.
to fix this just use the same code you used in "category.php" and copy it to "archive.php".
hope it works :)
Abdessamad Idrissi comments:
PS: if "archive.php" doesn't exist, then just duplicate "category.php" and name it "archive.php".
Auz Clement comments:
It's actually using a page named category-members.php. This is the template used when you are looking at post from the custom post-type "members". It is the same as category.php, but with the query changed to call the custom post-type "members".
Abdessamad Idrissi comments:
if you can grant me a temporary access to the dashboard I can fix this for you :)
Abdessamad Idrissi comments:
Did you notice : You are here: Home / Archive by category 'Members'
? in other categories it displays : You are here: Home / Members / Member Forms
so I think the problem is somewhere around the archive thing..
Sébastien | French WordpressDesigner answers:
the problem come from the function digi_no_nav probably
could you open the file function.php and search this function please ?
Auz Clement comments:
This function is not found in the functions.php. Thanks for your time, though.
Habib Rosyad answers:
Seems like there are others that have the same problem here:
[[LINK href="http://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1?replies=15#post-1859168"]]http://wordpress.org/support/topic/wp-nav-menu-dissapears-in-category-pages-1?replies=15#post-1859168[[/LINK]]
Its seems the problem lies in the querying process of the posts in the category... Hope it works for you... :)