Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dobrado

    (@dobrado)

    Sorry about the delay. :O

    I cannot make this work with wordpress loop.
    But worked with this JSON API: https://ww.wp.xz.cn/plugins/json-api/

    And jquery pagination. 🙂

    Thread Starter dobrado

    (@dobrado)

    Oh… It a really n00b mistake. 🙂

    Thanks for the support. Now I need to make infinite scroll works, but it are to another topic. 🙂

    Thanks again! o/

    Thread Starter dobrado

    (@dobrado)

    Hi! Sorry the delay! 🙁

    It worked! I made some modifications and added a “while” above pagination. 🙂
    But I did not understand what was wrong with my code. o.O

    My code (solved):

    <div id="latest_posts" class="container-fluid">
      <div class="row">
        <?php
        $temp_query = $wp_query;
          $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
          $args = array(
    
            'posts_per_page' => 9,
            'paged' => $paged,
         );
    
          /* make a new query for the events */
    
          $wp_query = new WP_Query( $args );
    
        $i = 1;
        while ( have_posts() ) : the_post();?>
    
          <div class="col-md-4">
            <div class="thumbnails">
              <a href="<?php the_permalink(); ?>">
                <?php if ( has_post_thumbnail()) : ?>
                    <?php the_post_thumbnail('post_thumbs', array('class' => 'img-responsive'));?>
                <?php else : ?>
                        <img class="img-responsive wp-post-image" src="<?php echo get_template_directory_uri() ?>/assets/img/no_thumb.png" alt="" />
                <?php endif; ?>
              </a>
              <div class="captions">
                <a href="<?php the_permalink(); ?>"><h4><?php the_title(); ?></h4></a>
                <small><?php the_excerpt(); ?></small>
              </div>
            </div>
          </div>
    
        <?php
        if($i % 3 == 0){
          echo '</div>';
          echo '<div class="row">';
        }
        $i++;
        ?>
        <?php
        endwhile;
        wp_reset_postdata();
        ?>
        <?php if ($wp_query->max_num_pages > 1) : ?>
          <div class="row">
            <nav class="pagination">
              <?php next_posts_link(__('Older posts', 'roots')); ?>
              <?php previous_posts_link(__('Newer posts', 'roots')); ?>
            </nav>
          </div>
        <?php endif; ?>
        <?php $wp_query = $temp_query; ?>
      </div>
    </div>

    Thread Starter dobrado

    (@dobrado)

    Yeah, I love Roots too! 🙂
    Widget to show my content? Can you recommend me a link about these widgets? 🙂

    About my content:
    The page above are a page template in “myblog.com/cases”.

    I tried to change the “wp_query” to “query”, the pagination works, but Root show the sidebar! o.O (Yes, I already added my template in custom.php for do not show sidebar)

    I read some tutorial about pagination, but all talk about using pagination with custom posts. 🙁
    Like: http://css-tricks.com/snippets/wordpress/paginate-custom-post-types/

    Thread Starter dobrado

    (@dobrado)

    I’m using the Roots Theme : http://roots.io/

    Roots Theme use Theme Wrapper (http://roots.io/an-introduction-to-the-roots-theme-wrapper/), and my code above go inside base.php:line23 (https://github.com/roots/roots/blob/master/base.php)

Viewing 5 replies - 1 through 5 (of 5 total)