WordPress $Paged and Page Navigation

wp-logoWeb 2 WordPress themes normally include featured articles or categories. Sometimes, popular articles, recent post or comments are likewise included. Examples of these themes are newspaper style themes displaying articles from selected categories. These themes do not usually include a page navigation. Users need to click on categories to be able to navigate deeper into articles. This seems a bit annoying.

Adding a page navigation such as the WP-PageNavi plugin will improve the navigation process. Following the installation and usage instruction from the plugin website is not enough to make the plugin work the way it is intended to be. Only the first page articles are being displayed despite any page number queried.

Example, these URLs

  • http://yourwebsite.com/
  • http://yourwebsite.com/?p=2
  • http://yourwebsite.com/index.php/paged/2
  • http://yourwebsite.com/?p=3
  • http://yourwebsite.com/index.php/paged/3

will still display the same page.

To get around these problem, insert

< ?php query_posts('paged=' . $paged); ?>

before the code block

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

The code block varies for every theme. Backup your theme files before doing any editing.

A Filipino Engineer, Registered Professional Engineer of Queensland (RPEQ) - Australia and Professional Electrical Engineer (PEE) - Philippines with extensive experience in concept select, front-end engineering, HV & LV detail design, construction and commissioning of Hazardous and Non-Hazardous Area electrical installations in water and waste water pipeline and pumping facilities, offshore platforms, hydrocarbon process plants and pipelines including related facilities. Hazardous area classification and design certification (UEENEEM015B, UEENEEM016B, UEENEEM017B).

2 thoughts on “WordPress $Paged and Page Navigation

  1. Jenna

    Pretty good post. I just found your blog and wanted to say
    that I’ve really liked browsing your posts. Any way
    I’ll be subscribing to your blog and I hope you write again soon!

Comments are closed.