• yahyaayob

    (@yahyaayob)


    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=10&showposts=3&paged=$paged");
    ?>
    
    <?php query_posts('orderby=date&order=ASC'); ?>
    
    <?php global $more; $more = 0; ?>
    
    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>

    sorting posts works but my pagination not working. Can help me plz?

    I’m using Wp-Pagnavi for the pagination.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael

    (@alchymyth)

    you are already getting the paged parameter – next step is to try and integrate it into the query:

    <?php query_posts('orderby=date&order=ASC&paged='.$paged'); ?>

    hope this works, good luck 😉

    Thread Starter yahyaayob

    (@yahyaayob)

    Thanks alchymyth.

    It didn’t work.

    <?php query_posts("cat=10orderby=date&order=ASC&paged='.$paged'"); ?>

    And I click on page 2 but it’s still on page 1.

    Michael

    (@alchymyth)

    there is a small error in your line (no & after ‘cat=10’):
    <?php query_posts("cat=10orderby=date&order=ASC&paged='.$paged'"); ?>

    should be:
    <?php query_posts("cat=10&orderby=date&order=ASC&paged='.$paged'"); ?>

    however, i am not sure if that would influence the pagination.

    there seems to be two lines with ‘query_posts’ in your code:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=10&showposts=3&paged=$paged");
    ?>
    
    <?php query_posts('orderby=date&order=ASC'); ?>
    
    <?php global $more; $more = 0; ?>
    
    <?php if (have_posts()) : ?>

    compact them into one line:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    ?>
    
    <?php query_posts("cat=10&orderby=date&order=ASC&paged='.$paged'"); ?>
    
    <?php global $more; $more = 0; ?>
    
    <?php if (have_posts()) : ?>

    hope this works.

    Thread Starter yahyaayob

    (@yahyaayob)

    Thanks alchymyth!

    I have done what you suggested and still not working.

    <div id="main-content">
    
    <div id="englishsostop">
    <div id="submit-a-photo"><a href="http://www.singanista.com/demosite/raise-english-s-o-s-photo-submission/"><h2>SUBMIT A PHOTO!</h2></a></div>
    </div>
    
    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    ?>
    
    <?php query_posts("cat=10&orderby=date&order=ASC&paged='.$paged'"); ?>
    
    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <?php $customFieldName = get_post_meta($post->ID, 'Name', true); ?>
    
    <div id="votebox"><?php if(function_exists('the_ratings')) { the_ratings(); } ?></div>
    
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    <div id="post-height-engsos"><div class="alignleft"><?php the_post_thumbnail('index-post-thumbnail'); ?></div>
    
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> by <?php echo $customFieldName; ?>
    
    <p class="cat-tag">CATEGORIES: <?php the_category(', ') ?> | <?php the_tags('TAGGED: ', ', ', ''); ?> | <?php the_time('F jS, Y') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <!-- by <?php the_author() ?> --></p>
    
    <div class="more-link"><?php the_content('<br />(READ MORE...)'); ?></div>
    
    </div>
    
    </div>
    
    <?php endwhile; ?>
    
    <?php if (next_posts_link() || previous_posts_link()): ?>
    
    <?php next_posts_link('&laquo; Older Entries') ?> | <?php previous_posts_link('Newer Entries &raquo;') ?>
    
    <?php endif ?>
    
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
    
    <?php else : ?>
    
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    
    <?php get_search_form(); ?>
    
    <?php endif; ?>
    
    </div>

    Any other ideas?

    Thread Starter yahyaayob

    (@yahyaayob)

    The pagination still did not work. I click on page 2 and the page shows me page 1 still.

    This is known issue I use this patch for ages: http://wordpress.org/extend/plugins/category-pagination-fix/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘query_posts to sort works but pagination not working’ is closed to new replies.