Grow your CSS skills. Land your dream job.

WordPress – pagination

  • # November 12, 2010 at 12:37 pm

    I have tried using a few guides for pagination but i can’t get any of them to even display the page numbers which i just don’t understand… So i have resorted to trying out a plug in, which atleast shows the page numbers, but when you click on page 2 it does nothing. Can anyone either help me get pagination working without this plug in or get this plug in to actually work?

    http://www.lsw-design.com/tf/Gridded/?page_id=8

    # November 12, 2010 at 10:07 pm

    doesn’t wordpress have it’s own pagination? Have you tried the template tags? if the plugin you are using doesn’t work, try a different one. There are lots of them. I don’t know how to help you without you giving access to your site. unless you post code

    # November 15, 2010 at 1:50 pm

    < ?php get_header(); ?>

    Blog

    < ?php get_sidebar(); ?>

    < ?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    'paged' => $paged,
    'posts_per_page' => 5,
    'caller_get_posts' => 0,
    );
    query_posts('cat=-5');
    if (have_posts()) :
    while (have_posts()) :
    the_post(); ?>

    ">< ?php echo getImage(302,302,"2");?>
    ">< ?php echo getImage(302,302,"");?>

    < ?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>

    ">< ?php the_title(); ?>

    < ?php the_excerpt(); ?>

    < ?php endwhile; else : ?>

    Woops...

    Sorry, no posts were found.

    < ?php wp_link_pages(); ?>
    < ?php endif; ?>

    < ?php wp_pagenavi(); ?>

    < ?php get_footer(); ?>

    Thats the code for the blog page, been trying to find answers for pagination since i started learning wordpress and haven’t found anything that works, or explains it in detail.

    # November 15, 2010 at 1:55 pm

    in your code, you have query_posts(‘cat=-5′);

    I think it should be query_posts(‘cat=5′);

    # November 15, 2010 at 1:56 pm

    p.s also check out the codex for more on this

    http://codex.wordpress.org/Function_Reference/query_posts

    # November 15, 2010 at 1:59 pm

    If i change it to just 5 no posts show

    # November 15, 2010 at 2:00 pm

    what version of wordpress are you using?

    # November 15, 2010 at 2:01 pm

    also, how many posts do you have in the category?

    # November 15, 2010 at 2:03 pm

    i have 7 posts in the category, and it is the latest version

    # November 15, 2010 at 2:04 pm

    so you see five posts but no pagination?

    # November 15, 2010 at 2:08 pm

    try moving your

    < ?php wp_link_pages(); ?>

    up before the

    < ?php endwhile; else : ?>

    wp_link_pages must be inside the loop. maybe it’s not executing where you have it?

    # November 15, 2010 at 2:17 pm

    tried moving that as well as < ?php wp_pagenavi(); ?> to different places, and still not working, if i put it before the endwhile; else then the page numbers show after every post and still doesnt work.

    # November 15, 2010 at 2:26 pm

    at this point, I would try a different loop



    < ?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>




    < ?php if ( in_category('5') ) { ?>

    < ?php } else { ?>

    < ?php } ?>

    " rel="bookmark" title="Permanent Link to < ?php the_title_attribute(); ?>">< ?php the_title(); ?>


    < ?php the_time('F jS, Y') ?> by < ?php the_author_posts_link() ?>

    < ?php the_content(); ?>


    < ?php endwhile; else: ?>


    Sorry, no posts matched your criteria.


    < ?php endif; ?>


    try that loop above. You can see the if(in_category(5)) part of the loop. Try it and see if it works. If it does, you can modify it to show the amount of posts that you want

    # November 15, 2010 at 2:59 pm

    that loop showed the posts, but it just done what it was doing before, when i click page 2 it just changes the URL and not the posts.

    # November 15, 2010 at 3:27 pm

    your problem is in here < ?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    'paged' => $paged,
    'posts_per_page' => 5,
    'caller_get_posts' => 0,

    if you check the url after clicking on the two, you can see the address is wrong. I don’t know how to fix it for you. Sorry

Viewing 15 posts - 1 through 15 (of 21 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".