• Resolved Lewis Tyler

    (@tylerjfrags)


    Hi Mike,

    Happy holidays ??

    We’re trying to add pagination to our site, with the aim of implementing some nice Ajax scrolling, which is going to look and feel really good.

    We’ve got the php code implemented and, successfully, pagination is showing.
    https://www.thenoisegate.com/test/

    However depending on how many posts we tell WordPress to load, it loads that many versions of tiles. So for example we have done 3 posts per page, it loads 3 versions of tiles with 3 tiles in each.

    in our page.php:

    <?php echo do_shortcode('[posts_2 posts_per_page="3" paging="true" order="DESC" orderby="date"]');

    in the content template:

    <?php if ( function_exists ( 'the_loop_wp_tiles' ) ) the_loop_wp_tiles(); ?>

    Obviously the theme is calling a shortcode which is probably causing the problem…

    How can we get these tiles integrated correctly?

    Our full page.php:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    					    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="https://schema.org/BlogPosting">
    
    						    <section class="post-content clearfix" itemprop="articleBody">
    						     <?php echo do_shortcode('[posts_2 posts_per_page="3" paging="true" order="DESC" orderby="date"]'); ?>
    						       </section> <!-- end article section -->

    Thanks very much for your patience Mike, this is the greatest & best supported free plugin I’ve ever seen!

    Lewis

    https://www.ads-software.com/plugins/wp-tiles/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Lewis!

    Thanks for the kind words ??
    I’m not sure I understand what’s happening exactly. Are you using the_loop_wp_tiles in the template that is used by the display posts shortcode?

    If so, what is the reason you are using Display Posts shortcode instead of WP Tiles directly? What you could do with WP Tiles is:

    [wp-tiles posts_query="numberposts=3&order=DESC&orderby=date"]

    This won’t give you pagination however. If you want to make a query like this with pagination, you have to edit your template (eg. page.php) and either set up a loop and use the_loop_wp_tiles or pass the query to WP Tiles directly:

    1. Example

    <?php // page.php
    query_posts( array(
        'posts_per_page' => 3,
        'order'          => 'DESC',
        'orderby'        => 'date',
        'paged'           => ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1
    ) );
    
    if ( function_exists ( 'the_loop_wp_tiles' ) )
        the_loop_wp_tiles();
    
    wp_reset_query();
    ?>

    But be aware of the caveats.

    2. Example

    <?php // page.php
    if ( function_exists( 'the_wp_tiles' ) ) {
        the_wp_tiles( array(
            'posts_per_page' => 3,
            'order'          => 'DESC',
            'orderby'        => 'date',
            'paged'           => ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1
        ) );
    }
    ?>

    Both examples are untested, so beware ??

    Let me know if it works out!

    Mike

    Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Lewis, have you had any luck? Let me know!
    Mike

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘More pagination problems’ is closed to new replies.