Pagination results of wordpress

Y try paginate results of wordpress and use this script , the problem it´s when i go paginate , the number of pages show right but if go the links of paginate always show the same content no change in each number of pages

<?php 
global $post;

if (have_posts()) : ?>


<?php 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'cat=36&posts_per_page=4' );
while (have_posts()) : the_post(); ?>
<div class="cols_posts">
<?php
$imagen = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
$ruta_imagen = $imagen[0];
echo '<img src="'.$ruta_imagen.'">';
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="extracto"><?php the_excerpt(); ?></div>
</div>
</div>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>

In tye page number one must show the content for that page , in the page 2 the same , etc but always show the same page , the first page content

Read More

Regards

Related posts

Leave a Reply

2 comments

  1. The problem is here:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts( 'cat=36&posts_per_page=4' );
    

    You are getting $paged variable correctly but you are not using it in a query.

    So add it to the query like this:

    query_posts( 'cat=36&posts_per_page=4&paged='.$paged );