Title: Post Navigation Links
Last modified: August 21, 2016

---

# Post Navigation Links

 *  Resolved [mpukit](https://wordpress.org/support/users/mpukit/)
 * (@mpukit)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/post-navigation-links-1/)
 * I’ve created a custom widget.php template and am posting the widget in a page
   on my site, and would like to add pagination.
 * Usually, I would just add ‘<?php post_navigation(); ?>’ after the ‘<?php endwhile;?
   >’ tag on any other template page I create, but in this case its not working.
 * Any idea why this customization won’t work in the widget.php template i’ve copied
   over to the /flexible-posts-widget directory?
 * [http://wordpress.org/extend/plugins/flexible-posts-widget/](http://wordpress.org/extend/plugins/flexible-posts-widget/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [mpukit](https://wordpress.org/support/users/mpukit/)
 * (@mpukit)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/post-navigation-links-1/#post-3945686)
 * Here’s what my custom template looks like now (just a few add-ins to the standard
   template – a date, excerpt…):
 *     ```
       <?php
       /**
        * Flexible Posts Widget: Default widget template
        */
   
       // Block direct requests
       if ( !defined('ABSPATH') )
       	die('-1');
   
       echo $before_widget;
   
       if ( !empty($title) )
       	echo $before_title . $title . $after_title;
   
       if( $flexible_posts->have_posts() ):
       ?>
       	<ul class="dpe-flexible-posts">
       	<?php while( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?>
       		<li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       			<a href="<?php echo the_permalink(); ?>">
       				<?php
       					if( $thumbnail == true ) {
       						// If the post has a feature image, show it
       						if( has_post_thumbnail() ) {
       							the_post_thumbnail( $thumbsize );
       						// Else if the post has a mime type that starts with "image/" then show the image directly.
       						} elseif( 'image/' == substr( $post->post_mime_type, 0, 6 ) ) {
       							echo wp_get_attachment_image( $post->ID, $thumbsize );
       						}
       					}
       				?>
       				<h4 class="title"><?php the_title(); ?></h4>
       			</a>
       			<?php the_time('Y-m-d', '<h2>', '</h2>'); ?>
       			<?php the_excerpt() ?>
       		</li>
       	<?php endwhile; ?>
       	<?php post_navigation(); ?>
       	</ul><!-- .dpe-flexible-posts -->
       <?php else: // We have no posts ?>
       	<div class="dpe-flexible-posts no-posts">
       		<p><?php _e( 'No post found', 'flexible-posts-widget' ); ?></p>
       	</div>
       <?php
       endif; // End have_posts()
   
       echo $after_widget;
       ```
   
 *  Plugin Author [DaveE](https://wordpress.org/support/users/dpe415/)
 * (@dpe415)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/post-navigation-links-1/#post-3945976)
 * Hi mpukit,
 * Sorry for the slow response. The bottom line is that FPW isn’t build to handling
   paging.
 * Specifically, the plugin has specific query vars set to only get the number of
   posts requested in the widget settings, so paging is effectively disabled. To
   enable paging, the plugin core would need to be modified to watch for a unique
   page number query var (or AJAX call) and then add that page number query var 
   to each page/AJAX request.
 * In this case, you’re probably better off just creating a custom theme archive
   template and handling the display of posts that way since archive templates already
   have supoort for paging.
 * Sorry I’m not more help here. Thanks for trying out the plugin!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post Navigation Links’ is closed to new replies.

 * ![](https://ps.w.org/flexible-posts-widget/assets/icon-256x256.jpg?rev=984592)
 * [Flexible Posts Widget](https://wordpress.org/plugins/flexible-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flexible-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flexible-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/flexible-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flexible-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flexible-posts-widget/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [DaveE](https://wordpress.org/support/users/dpe415/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/post-navigation-links-1/#post-3945976)
 * Status: resolved