0

I'm having this strange glitch with a nav menu obtianed through wp_nav_menu().

The function returns the menu correctly in every situation except for when the query string in an ARCHIVE request includes the 'cat' parameter. For example:

I have a custom post type 'Stories' for which the archive is just myhomeurl.com/story. For this page, wp_nav_menu() will return the menu correctly and as such will display as it should.

But if I want to see just the stories with a certain category (i.e. myhomeurl.com/story/?cat=5), then wp_nav_menu() will not return anything. It's not a display issue, it is just that wp_nav_menu() will not return any markup.

I have no idea what could be causing this, all I have been able to figure out is those conditions: in an archive with the category parameter set in the query string.

Just in case it is relevant, I am using a customized child theme of the 'Responsive' theme.

Unfortunately this is a local build so I can't really link to the site itself, I hope that is not an issue.

Thank you in advance for any help.

4

1 回答 1

1

我也有同样的问题。似乎自定义帖子类型与您的导航混淆了。如果你用这个包装你的导航代码,它应该可以工作:

<?php   $backup = $wp_query;
        $wp_query = NULL;
        $wp_query = new WP_Query(array('post_type' => 'post')); 

        //nav code goes here

        $wp_query = $backup; ?>
于 2014-01-02T22:12:54.323 回答