Pages and custom query (3 posts)

  1. SoulGod
    Posted 3 years ago #

    I am having troubles getting this to work..

    When I click page 2, the same entries as in "page 1"...

    <?php if (have_posts()) : ?>
                    <?php $post = $posts[0]; $c=0;?>
                    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    				query_posts( array( 'paged' => get_query_var('paged') ) );
                    //query_posts('author_name=admin&posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
    				query_posts('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);?>
    				<?PHP //query_posts ( 'author_name=admin' ); ?>
                    <?php while (have_posts()) : the_post(); ?>
    				<?php $c++; if( $c == 1) :?>
                    <?php $i = 1; ?>
                        <!-- start entry post -->

    And in the end of the page i have this:

    <div class="navigation">
                        <?php wp_pagenavi(); ?>
                        <!--<div class="alignright"><?php //next_posts_link('Tidigare inlägg &raquo;') ?></div>
                        <div class="alignleft"><?php //previous_posts_link('&raquo; Senare inlägg') ?></div>-->
                    <?php wp_reset_query(); ?>
                    <br />


  2. Hiranthi
    Posted 3 years ago #

    You should actually _never_ use query_posts (ask Nacin, he had a great presentation about that on the last WordCampNL). Try using the WP_Query class instead.

  3. abaloo
    Posted 3 years ago #

    @Hirnathi you are correct...but that doesn't help with the issue.

    Please can someone respond. I *am* using Wp_Query but the same thing is happening as described by @soulgod.

    Can anyone help?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic