WordPress.org

Support

Support » Plugins and Hacks » WP Tiles » [Resolved] How I add a pagination on plugin? It is possible?

[Resolved] How I add a pagination on plugin? It is possible?

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

    @mike_cowobo

    Hi Alice,

    Only if you use WP Tiles using the template tags (the_wp_tiles, the_loop_wp_tiles, etc.). So as long as you edit your (child)theme files directly, you can implement pagination.

    It will work the same as normally. Check out the chapter “Can I show tiles in my templates, for example on in the category archives?” in the FAQ.

    Good luck!

    Hi Mike ! thanks for answer, I tryed everything and i still can’t do it ! I need to put a numeric pagination on post tiles. Please can you help-me?
    For my project finish I just need do it works ! Thanks one more time

    My code is :

    <?php query_posts(“cat=&paged=$paged”); if (have_posts()) : ?>
    <?php if ( function_exists ( ‘the_loop_wp_tiles’ ) ) : the_loop_wp_tiles(); endif; ?>
    <?php else : ?>
    <?php getpagenavi(); ?>
    <?php endif; ?>

    Plugin Author Mike Martel

    @mike_cowobo

    Hi Alice!

    Your page navigation was only called if the_loop_wp_tiles did not exist! This should do the trick:

    <?php query_posts("cat=&paged=$paged"); if (have_posts()) : ?>
        <?php if ( function_exists ( 'the_loop_wp_tiles' ) ) : ?>
            <?php the_loop_wp_tiles(); ?>
        <?php endif; ?>
        <?php getpagenavi(); ?>
    <?php endif; ?>

    Hi Mike, thanks for one more time 🙂
    I tryed add this code, but the pagination doesn’t showed up again, I installed the plugin “pagenavi” for pagination … Do you think that need specify the number of post and the template I’m using?

    I don’t know why it’s not working 🙁

    I put this code:

    <?php
    global $query_string; parse_str( $query_string, $my_query_array );
    $paged = ( isset( $my_query_array[‘paged’] ) && !empty( $my_query_array[‘paged’] ) ) ? $my_query_array[‘paged’] : 1; query_posts(“numposts=4&paged=$paged”);
    ?>
    <?php query_posts(“cat=&paged=$paged”); if (have_posts()) : ?>
    <?php if ( function_exists ( ‘the_loop_wp_tiles’ ) ) : ?>
    <?php the_loop_wp_tiles(); ?>
    <?php endif; ?>
    <?php wp_pagenavi(); ?>
    <?php endif; ?>

    Plugin Author Mike Martel

    @mike_cowobo

    Hi Alice,

    In the code of your last comment, you’re calling query_posts twice. The second one will simply overwrite the first.

    Secondly, what is the reason you’re using query_posts at all? Unless you want to override most WPs own query mechanism, it is too powerful a weapon, as it overrides any previous global query. If it’s just influencing the amount of posts per page, try filtering the request instead. Or, use plugin like Posts per Category.

    It’s worth checking the Codex page on query_posts. Not all of it has to be fully understood, but it will give an insight into how the query normally works and what you can do to change it.

    Long story short.. if you just want to limit the no. of posts.. use the plugin above, and change your template code back to if ( have_posts() ) : the_loop_wp_tiles(); endif; (or something along those lines..)

    Let me know if it works out!

    Mike

    Hi,

    I tried to have pagination on my home site with posts in tiles, but I cannot make it work. I work with template twenty-thirteen, I edited file index.php from:

    <?php if ( have_posts() ) : ?>
      <?php /* The loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
          <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>
      <?php twentythirteen_paging_nav(); ?>
    <?php else : ?>
      <?php get_template_part( 'content', 'none' ); ?>
    <?php endif; ?>

    to

    <?php if ( have_posts() ) : ?>
      <?php /* The loop */ ?>
        <?php if ( function_exists ( 'the_loop_wp_tiles' ) ) : ?>
          <?php the_loop_wp_tiles(); ?>
        <?php endif; ?>
      <?php twentythirteen_paging_nav(); ?>
    <?php else : ?>
      <?php get_template_part( 'content', 'none' ); ?>
    <?php endif; ?>

    and nothing happens 🙁 Can anyone help me?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] How I add a pagination on plugin? It is possible?’ is closed to new replies.
Skip to toolbar