Home>Support>Post Loop Widget – No Pagination

Post Loop Widget – No Pagination

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

I’m using the post loop widget, but there’s no pagination. I tried changing templates and inserting the pagination code in a templet, but found the POST LOOP TEMPLATE is the format of one post, so it inserts the pagination under each excerpt. NOT what we want. It should be after the entire loop ends.

Is there a widget or shortcode to put it underneath the post loop?

Ideally, this should actually be an option in the widget itself: _ SHOW PAGINATION

Thank you.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 5 years, 21 days ago Jennifer Moss

    I found where the code should go:

    /wp-content/plugins/siteorigin-panels/inc/widgets/post-loop.php

    line 205 after: echo $args[‘after_widget’];

    [INSERT PAGINATION HERE]

  2. 5 years, 21 days ago Jennifer Moss

    I have temporarily put our code’s pagination code there, but it will be overwritten with your next release. At least put a hook there???

  3. 5 years, 21 days ago Andrew Misplon
    Hi, I Work Here

    Hi Jennifer

    Thanks for reaching out.

    If you’re using a child theme or a custom plugin, it should be relatively quick to copy your theme loop and create a custom template. Here is an example of a loop template with pagination:

    https://github.com/siteorigin/siteorigin-corp/blob/develop/loops/loop-blog-standard.php

    More on adding a custom template to your child theme or plugin at the following URL:

    Page: Post Loop Widget

    Hopefully, that helps.

  4. 5 years, 21 days ago Jennifer Moss

    Since we’re putting this widget on a PAGE, it’s using the page template – which then hosts your widget, which then calls the “loop”.

    The theme loop file only has the internal HTML for each post. It’s your widget and your code that’s running it.

  5. 5 years, 21 days ago Jennifer Moss

    Here’s our LOOP FILE which we did copy to our child theme. As you can see it’s just the internal part of the loop. If we put PAGINATION in this template it will show under every article excerpt. So that is not a solution.

    <?php
    /**
     * Post loop content
     *
     * @package Virtue Theme
     */
    
    if ( virtue_display_sidebar() ) {
    	$kt_feat_width       = apply_filters( 'kt_blog_image_width_sidebar', 846 );
    	$kt_portraittext     = 'col-md-7';
    	$kt_portraitimg_size = 'col-md-5';
    } else {
    	$kt_feat_width       = apply_filters( 'kt_blog_image_width', 1140 );
    	$kt_portraittext     = 'col-md-8';
    	$kt_portraitimg_size = 'col-md-4';
    }
    
    $postsummery = get_post_meta( get_the_ID(), '_kad_post_summery', true );
    $height      = get_post_meta( get_the_ID(), '_kad_posthead_height', true );
    $swidth      = get_post_meta( get_the_ID(), '_kad_posthead_width', true );
    // get_width.
    if ( ! empty( $height ) ) {
    	$slideheight = $height;
    } else {
    	$slideheight = apply_filters( 'kt_post_excerpt_image_height', 400 );
    }
    // get height.
    if ( ! empty( $swidth ) ) {
    	$slidewidth = $swidth;
    } else {
    	$slidewidth = apply_filters( 'kt_post_excerpt_image_width', $kt_feat_width );
    }
    // get post summary.
    if ( empty( $postsummery ) || 'default' === $postsummery ) {
    	$postsummery = virtue_premium_get_option( 'post_summery_default' );
    }
    
    ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class( 'kad_blog_item kad-animation' ); ?> data-animation="fade-in" data-delay="0">
    	<div class="row">
    		<?php
    		if ( 'img_landscape' === $postsummery ) {
    			$textsize = 'col-md-12';
    			if ( has_post_thumbnail( get_the_ID() ) ) {
    				$image_id = get_post_thumbnail_id( get_the_ID() );
    			} else {
    				$image_id = null;
    			}
    			$img_args = array(
    				'width'         => $slidewidth,
    				'height'        => $slideheight,
    				'crop'          => true,
    				'class'         => 'iconhover',
    				'alt'           => null,
    				'id'            => $image_id,
    				'placeholder'   => true,
    				'schema'        => false,
    				'intrinsic'     => true,
    				'intrinsic_max' => true,
    			);
    			?>
    			<div class="col-md-12 post-land-image-container">
    				<div class="imghoverclass img-margin-center">
    					<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    						<?php virtue_print_full_image_output( $img_args ); ?>
    					</a> 
    				</div>
    			</div>
    			<?php
    		} elseif ( 'img_portrait' === $postsummery ) {
    			$textsize       = $kt_portraittext;
    			$portraitwidth  = apply_filters( 'kt_post_excerpt_image_width_portrait', 365 );
    			$portraitheight = apply_filters( 'kt_post_excerpt_image_height_portrait', 365 );
    			if ( has_post_thumbnail( get_the_ID() ) ) {
    				$image_id = get_post_thumbnail_id( get_the_ID() );
    			} else {
    				$image_id = null;
    			}
    			$img_args = array(
    				'width'         => $portraitwidth,
    				'height'        => $portraitheight,
    				'crop'          => true,
    				'class'         => 'iconhover',
    				'alt'           => null,
    				'id'            => $image_id,
    				'placeholder'   => true,
    				'schema'        => false,
    				'intrinsic'     => true,
    				'intrinsic_max' => true,
    			);
    			?>
    			<div class="<?php echo esc_attr( $kt_portraitimg_size ); ?> post-image-container">
    				<div class="imghoverclass img-margin-center">
    					<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    						<?php virtue_print_full_image_output( $img_args ); ?>
    					</a> 
    				</div>
    			</div>
    			<?php
    		} elseif ( 'slider_landscape' === $postsummery ) {
    			$textsize = 'col-md-12';
    			?>
    			<div class="col-md-12 post-land-image-container">
    				<?php
    				$image_gallery = get_post_meta( get_the_ID(), '_kad_image_gallery', true );
    				virtue_build_slider( get_the_ID(), $image_gallery, $slidewidth, $slideheight, 'image', 'kt-slider-same-image-ratio' );
    				?>
    			</div>
    			<?php
    		} elseif ( 'slider_portrait' === $postsummery ) {
    			$textsize       = $kt_portraittext;
    			$portraitwidth  = apply_filters( 'kt_post_excerpt_image_width_portrait', 365 );
    			$portraitheight = apply_filters( 'kt_post_excerpt_image_height_portrait', 365 );
    			?>
    			<div class="<?php echo esc_attr( $kt_portraitimg_size ); ?> post-image-container">
    				<?php
    				$image_gallery = get_post_meta( get_the_ID(), '_kad_image_gallery', true );
    				virtue_build_slider( get_the_ID(), $image_gallery, $portraitwidth, $portraitheight, 'image', 'kt-slider-same-image-ratio' );
    				?>
    			</div>
    			<?php
    		} elseif ( 'video' === $postsummery ) {
    			$textsize = 'col-md-12';
    			?>
    			<div class="col-md-12 post-land-image-container">
    				<div class="videofit">
    					<?php
    					$video = get_post_meta( get_the_ID(), '_kad_post_video', true );
    					echo do_shortcode( $video );
    					?>
    				</div>
    			</div>
    			<?php
    		} else {
    			$textsize = 'col-md-12 kttextpost';
    		}
    		?>
    		<div class="<?php echo esc_attr( $textsize ); ?> post-text-container postcontent">
    			<?php
    			/**
    			 * Virtue Post Excerpt Before Header
    			 *
    			 * @hooked virtue_post_before_header_meta_date - 20
    			 */
    			do_action( 'virtue_post_excerpt_before_header' );
    			?>
    			<header>
    				<?php
    				/**
    				 * Virtue Post Excerpt Header
    				 *
    				 * @hooked virtue_post_excerpt_header_title - 10
    				 * @hooked virtue_post_header_meta - 20
    				 */
    				do_action( 'virtue_post_excerpt_header' );
    				?>
    			</header>
    			<div class="entry-content">
    				<?php
    				do_action( 'kadence_post_excerpt_content_before' );
    
    				the_excerpt();
    
    				do_action( 'kadence_post_excerpt_content_after' );
    				?>
    			</div>
    			<footer>
    				<?php
    				/**
    				 * Virtue Post Excerpt Footer
    				 *
    				 * @hooked virtue_post_footer_tags - 10
    				 */
    				do_action( 'virtue_post_excerpt_footer' );
    				?>
    			</footer>
    			<?php
    				do_action( 'virtue_post_excerpt_after_footer' );
    			?>
    		</div><!-- Text size -->
    	</div><!-- row-->
    </article> <!-- Article -->
    
  6. 5 years, 20 days ago Andrew Misplon
    Hi, I Work Here

    Thanks for your reply.

    You can create a custom loop template with pagination and then select that template in the Post Loop widget.

  7. 5 years, 20 days ago Andrew Misplon
    Hi, I Work Here

    If you aren’t already using a child theme, you can find a child theme for Virtue here.

    Copy page-blog.php from the parent theme and insert the file into your child theme. Rename page-blog.php to loop-blog.php. Once that’s done you’ll be able to select loop-blog.php within the Post Loop widget.

    If you’re installing a child theme late in the site’s development, see our guide on migrating Customizer settings from the parent to the child theme Post: Migrating Parent to Child Theme Customizer Settings.

    It’s possible to name your post loop template as required. You can also go the route of adding this new template via a plugin. More info on that here Page: Post Loop Widget.

  8. 5 years, 20 days ago Jennifer Moss

    I’m using a child theme.

  9. 5 years, 20 days ago Andrew Misplon
    Hi, I Work Here

    Sounds good, let us know how it goes.

  10. 5 years, 20 days ago Jennifer Moss

    That didn’t work – it broke the layout.

  11. 5 years, 20 days ago Jennifer Moss

    It showed full posts, then a post loop under it, then the divs were all off. Why can’t you just take the note and put the PAGINATION in your widget? Obviously from all the posts about this, it’s a necessary addition.

  12. 5 years, 20 days ago Andrew Misplon
    Hi, I Work Here

    The Post Loop widget looks for the following patterns:

    *-content.phpcontent-*.php*-loop.phploop-*.php

    The reason there are requests to add pagination is because many themes don’t have appropriately named loop files so only the content partials show up in the available template list. Content partials are used within a typical loop/index/archive file meaning they don’t have pagination. The issue is not with the widget, the widget wasn’t designed to build a template, it’s a lightweight option designed to build a query, in this case, it’s the theme’s job to provide a compatible template. If you’d like to see an example of this, fully functional, try our SiteOrigin Corp theme in a demo install on your local or live server. Example Post Loop page https://demo.siteorigin.com/corp/standard-blog-layout/.

    Here is an example using a Virtue child theme: https://demo.siteorigin.com/static-demo-page/. The page template being used in this demo is the “Default” Virtue page template selected in the right column when editing the page.

    Here is a copy of the child theme being used at the above link.
    https://siteorigin.com/wp-content/uploads/2020/06/virtue_child.zip

  13. 5 years, 20 days ago Andrew Misplon
    Hi, I Work Here

    Here is an updated child theme you can try out/experiment with:
    https://siteorigin.com/wp-content/uploads/2020/06/virtue_child_02.zip

    The updated child theme simplifies and improves upon the first child theme. You can see the work done in the child theme in the loop-blog.php file and the style.css file. When selecting the template in the Post Loop widget, the name is “Blog” when using this child theme.

    This is more than we’re usually able to offer within our free support scope due to budget limitations, hopefully this second child theme helps.

    We’ve begun work on a Blog widget which would have been the ideal solution for what you’re trying to do. We should have that released into the Widgets Bundle in the next few months.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More