Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins.

                        <?php if ( $wp_query->have_posts() ) : ?>

                            <?php twentyeleven_content_nav( 'nav-above' ); ?>

                            <?php /* Start the Loop */ ?>

                                    <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

                                    <?php get_template_part( 'content-beers', get_post_format() ); ?>

                            <?php endwhile; ?>

                            <?php wp_reset_query(); ?>

                            <?php twentyeleven_content_nav( 'nav-below' ); ?>

Live site page

share|improve this question

2 Answers 2

This code didn't change since Twenty Eleven's initial release. Navigation is only printed if your query has more than one page. Could that be it?

Since you are calling $wp_query->have_posts() rather than have_posts(), this suggests you are modifying or overriding the query, which may be confusing WordPress (and it's not WP's fault). (See When should you use WP_Query vs query_posts() vs get_posts()?.)

share|improve this answer
    
Thanks, I will take a look at that link. The way I was doing it was compatible with 3.4 but not with 3.5. I verified that the link disappeared immediately after upgrade (I didn't upgrade with other plugins that may have caused the change either). –  Adam Dec 17 '12 at 21:37
    
I streamline & modified the code to fit that logic (I think?) but still no luck on getting navigation links to show up: pastebin.com/vMxRN4tx –  Adam Dec 18 '12 at 0:46

Winning code (had someone help & it looks like they more or less copy-pasted from the front page. Not sure why I had arranged it differently on the beers page to begin with...

    <?php query_posts('post_type=beer&paged='.get_query_var('paged') ); ?>

        <?php if ( have_posts() ) : ?>

            <?php /* Start the Loop */ ?>

                <?php while ( have_posts() ) : the_post(); ?>

                <?php if ( 'beer' == get_post_type() ) {

                    get_template_part( 'content-beers', get_post_format() ); 

                } else;

            ?>

            <?php endwhile; ?>
        <?php else : ?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.