[resolved] Pagination not working (7 posts)

  1. sh_son
    Posted 2 years ago #


    I'm attempting to implement 'pagination' feature into a custom theme but for some reason I am not seeing any text or pagination. I have simply copy and pasted the codes from here (http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/). But after reading through WordPress documentation it seems that I need to have pagination variables in order to have pagination navigation to work.

    Can someone point me to a right direction?

    Thank you.

  2. tomontoast
    Posted 2 years ago #

  3. Michael
    Part-Time Forum Moderator
    Posted 2 years ago #

    from the linked tut:

    <?php if (function_exists("pagination")) {
    } ?>

    this $additional_loop depends on your used query;

    for a 'normal' loop this might need to be replaced with $wp_query

    it might help if you paste the full code of your template into a pastebin and post the link to it here - see http://codex.wordpress.org/Forum_Welcome#Posting_Code

  4. sh_son
    Posted 2 years ago #

    Thank you, alchymyth.

    I have posted the template code into pastebin here.
    As of now I do not have any functions/code relating to pagination, as it kept failing to work.

  5. sh_son
    Posted 2 years ago #

    I would also like to add that pagination plugins such as 'WP-paginate' does not work.
    I'd only assume that I am missing a key piece of code, still going through google search and WordPress documentations.

  6. Michael
    Part-Time Forum Moderator
    Posted 2 years ago #

    add the 'paged' parameter to this line:

    <?php $the_query = new WP_Query('showposts = 5');?>


    <?php $the_query = new WP_Query('posts_per_page = 5 & paged = ' . get_query_var('paged'));?>

    then try for instance these basic pagination links somewhere after the <?php endwhile;?>

    <?php next_posts_link('Older Entries ยป', $the_query->max_num_pages); ?>
    <?php previous_posts_link('Newer Entries', $the_query->max_num_pages); ?>


  7. akumar_xavient
    Posted 2 years ago #

    Hey Guys ,
    Must use
    global $paged,$wp_query;

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.