• I’m building my first plugin that adds some extra homepage templates to my theme. The problem is the paging is not loading older or newer posts and I’m not sure whats wrong.

    Can you take a quick look at point me in the right direction.

    Thanks

    Query Loop on template

    $temp = $wp_query; $wp_query= null;
        $wp_query = new WP_Query(); $wp_query->query('showposts=7' . '&paged='.$paged);
    
        while ($wp_query->have_posts()) : $wp_query->the_post();

    Call to navigation function (the function is part of theme not this plugin) at bottom of template
    eryn_paging_nav()

    eryn_paging_nav() function code:

    if ( ! function_exists( 'eryn_paging_nav' ) ) :
    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function eryn_paging_nav() {
    	// Don't print empty markup if there's only one page.
    	if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
    		return;
    	}
    	?>
    	<nav class="navigation paging-navigation" role="navigation">
    		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'eryn' ); ?></h1>
    		<div class="nav-links">
    
    			<?php if ( get_next_posts_link() ) : ?>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'eryn' ) ); ?></div>
    			<?php endif; ?>
    
    			<?php if ( get_previous_posts_link() ) : ?>
    			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'eryn' ) ); ?></div>
    			<?php endif; ?>
    
    		</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    }
    endif;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘paging not working’ is closed to new replies.