• Resolved dewolfe001

    (@dewolfe001)


    I poked into the code:
    in includes\shortcodes\posts.php
    (ca. line 250)
    – I added a reference to $paged.
    – I added a reference to that in the args:

    
    	$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    	$args = array(
    		'category_name'  => '',
    		'order'          => $order,
    		'orderby'        => $orderby,
    		'post_type'      => explode( ',', $post_type ),
    		'posts_per_page' => $posts_per_page,
    		'paged'			 => $paged,
    		'tag'            => $tag,
    	);

    To leave the code as close to the baseline as possible, I put in code to carry out the pagination:

    
    function su_pager($query, $total_page) {
        global $paged;
    	$paging = "";
    
    	// do the pagination
        if(function_exists('wp_pagenavi')) {
            $paging .='<div class="page-navigation">'.wp_pagenavi(array('query' => $query, 'echo' => false)).'</div>';
        } else {
            $paging .='
            <span class="next-posts-links">'.get_next_posts_link('>', $total_page).'</span>
            <span class="prev-posts-links">'.get_previous_posts_link('<').'</span>
            ';
        }
    	return $paging;
    }

    In the loops:

    
    // Posts are found
    if ( $posts->have_posts() ) {
    	$posts_per_page = 10;
    	$total_found_posts = $posts->found_posts;
    	$total_page = ceil($posts / $posts_per_page);	
    	
    	while ( $posts->have_posts() ) {

    … custom code….

    `}
    print ‘</ul>’;
    print su_pager($posts, $total_page);
    }
    // Posts not found
    else {
    ?>
    <li><?php _e( ‘Nothing found’, ‘shortcodes-ultimate’ ) ?></li>
    </ul>
    <?php
    }
    ?>`

Viewing 1 replies (of 1 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi @dewolfe001,

    I really appreciate your commitment, but right now I’m working on a new version of the posts shortcode. You can watch the process in the Posts branch of the GitHub repo. The new version will have pagination out of the box and will be available in 2-3 future releases.

    Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘Pagination Alteration’ is closed to new replies.