WordPress.org

Ready to get started?Download WordPress

Forums

WP Tiles
[resolved] More pagination problems (3 posts)

  1. tylerjfrags
    Member
    Posted 8 months ago #

    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.
    http://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="http://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

    http://wordpress.org/plugins/wp-tiles/

  2. Mike
    Member
    Plugin Author

    Posted 7 months ago #

    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

  3. Mike
    Member
    Plugin Author

    Posted 7 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.