WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After getting help from ghost toast... I am almost seeing the light of day with this issue. Using this code I have been able to have a query of post show. However I am unable to figure out how to code it to work with the navigation. Thanks Ghost!

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

    <div class="post" id="post-<?php the_ID(); ?>">
        <p class="post-date">
            <span class="date-day"><?php the_time('j') ?></span>
            <span class="date-month"><?php the_time('M') ?></span>
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

        <div class="entry">
            <?php the_excerpt(); ?>

   <p class="metadata">Posted by <?php the_author() ?>.<?php edit_post_link('Edit', ' |     
', ''); ?></p>

<?php endwhile; endif; ?>

global $wp_query;

$query = new WP_Query( 'cat=1' );

 $big = 999999999; // need an unlikely integer

 echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
share|improve this question
Define "navigation". – Rarst Jun 22 '13 at 21:45
Adding to Rarst's, please add more details to your Questions, brief descriptions of your problems doesn't invite to thoughtful Answers. A guide to good questioning: How to Ask. – brasofilo Jun 22 '13 at 23:20
Navigation - As in Page Navigation meaning let's say six post to each page of post. six displaying on "1" then click to "2" for the next six post. Do you know what I mean or do I need to render an example? – Jusherb Jun 24 '13 at 3:33
codex.wordpress.org/Function_Reference/paginate_links read that yet? – GhostToast Jun 24 '13 at 13:49
@GhostToast No I haven't thanks man, I was reading and researching here (digwp.com/2013/01/display-blog-posts-on-page-with-navigation) This is the page I'm working on, built it sometime back (gods-image.com/news-2) The way I built the page the div that holds the main content des not expand. Lets just say 4 post to a page then have either a <Next> <Prev> link or numbered page nav to move on to the next set of post. It really doesnt matter if its next or prev or numbered... Question is my code above set up correctly to support that functionality? It's a custom query. – Jusherb Jun 24 '13 at 13:58

Not sure about all the other custom stuff you're running in there. But looks like you have taken a few tutorials and maybe mashed them together. I think something simple like this might work for you, then you can add some bells and whistles or try for paged navigation later. This will get you regular old Previous and Next links, which you indicated would satisfy your needs for now:

    while (have_posts()) : the_post();
        <article id="post-<?php the_ID(); ?>" class="blog-object">
            <h2 class="blog-title">
                <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>

            <div class="blog-entry-meta">
                <small><?php the_time('F jS, Y'); ?></small>
            <?php the_content();?>
<div class="navigation">
    <span class="older"><?php next_posts_link('« Older') ?></span>
    <span class="newer"><?php previous_posts_link('Newer »') ?></span> 
</div><!-- .navigation -->

Feel free to modify that to accomodate other elements you want, such as author meta.

share|improve this answer
using the above code How would I code php to display a certain number of post per page. Let's just say 4 post per page? – Jusherb Jun 24 '13 at 15:20
You can actually set default posts per page under Settings -> Reading -- simple to do it there if you're not rolling your own WP_Query. But if you are rolling your own, look at this: Class Reference/WP Query « WordPress Codex – GhostToast Jun 24 '13 at 15:24
Man I read the whole WP_Query two times man and nothing... I'm seeing the light of day but can't seem to figure out how to get the links with the page numbers to work. When I click on a page number it displays the same post. Doesnt carry over to the next set of post. – Jusherb Jun 24 '13 at 19:03
@EAMann Can you undelete my answer? – Jusherb Jun 25 '13 at 20:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.