Thread Starter
mpukit
(@mpukit)
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
(@dpe415)
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!