0

I have integrated WordPress transient system with w3 total cache. Now I can`t to do pagination for this query.

<?php
  $paged1 = (get_query_var('paged1')) ? get_query_var('paged1') : 1;
  $recent1 = get_transient( 'recent1' );
  if ( false === $recent1) {
    $recent1 = new WP_Query ('cat=3&posts_per_page=5'.'&paged='.$paged1);
     set_transient('recent1', $recent1, 60*60);
  }
  // do normal loop stuff
  if ($recent1->have_posts()) : while ($recent1->have_posts()) : $recent1->the_post();
?>
<div id="line">
  <a href="<?php the_permalink () ?>" rel="bookmark">
    <h2><?php the_title (); ?></h2>
    <?php the_post_thumbnail(array(100,100), array('class' => 'alignleft')); ?>
    <?php the_advanced_excerpt(); ?>
  </a>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>  
  • 3
    How do you set 'paged1'? – fuxia Jul 20 '12 at 11:13
0

Did you try this?

$paged1 = (get_query_var('page')) ? get_query_var('page') : 1;
  • Yes, i have tried. It is work but there is a problem. Sometimes on page/2 there is content of page/1 or on the contrary. It seems caches sometimes confused. How to set they right ?) – Ronin Jul 21 '12 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.