yad4u WordPress Pagination on Page


WordPress Pagination on Page



I have the following code on a WordPress page. It basically just grabs 3 posts and displays them as well as the page content itself up top. What I want to add is pagination so that a user can flick through all the posts, how do I get this working with custom loops like this?

    <?PHP          get_header();          /* Template Name: News */      ?>      <div style="padding: 0 20px;">           <div class="box clearfix side" style="margin:10px 0;">          <div style="float:left;width:628px;">          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                 <div class="content" id="post-<?php the_ID(); ?>">                     <h2><?php the_title(); ?><?php edit_post_link('Edit', ' <small>[', ']</small>'); ?></h2>          <?php the_content('<p>Read the rest of this page &raquo;</p>'); ?>                       <?php wp_link_pages(array('before' => '<p>Pages: ', 'after' => '</p>', 'next_or_number' => 'number')); ?>                       <hr />                  </div>                 <?php endwhile; endif; ?>  <hr />          <?php $blog_query = new WP_Query('posts_per_page=3'); while ($blog_query->have_posts()) : $blog_query->the_post(); ?>              <div class="content" id="post-<?php the_ID(); ?>">                  <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>                    <?php the_excerpt(); ?>              </div>            <?php endwhile; ?>          <?php if ($blog_query->have_posts()) : ?>              <?php if(function_exists('wp_pagenavi'))             {                 wp_pagenavi();             }             ?>                  <?php else: ?>                  <h2>oooops!!!</h2>                   <?php endif; ?>           </div>           </div>      </div>      <?PHP          get_footer();      ?> 

Outputting wordpress custom date field in different format

1:

Conditional if statement / is_page not working in WordPress 3.0
Are you sure you're not re-inventing the wheel a little here? Why not set the number of posts to display in the admin, then use WP's native paging for the blog?. WordPress: first lower case p of each word not showing in main content area
Implement custom template (static web - HTML) on WordPresschange the function wp_list_pages in wordpress

2:

nginx error “ 504 Gateway Timeout”
Turns out you have to did any thing like this:. Best practices for displaying a webpage in different languages
<?php $temp = $wp_query; $wp_query= null; ?>                  <?php $wp_query = new WP_Query(array('posts_per_page' => 3, 'paged' => $paged)); while ($wp_query->have_posts()) : $wp_query->the_post(); ?>              <div class="content" id="post-<?php the_ID(); ?>">                  <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attrialthough e(); ?>"><?php the_title(); ?></a></h4>                  <?php the_excerpt(); ?>              </div>          <?php endwhile; ?>          <?php if(function_exists('wp_pagenavi'))         {             wp_pagenavi();         }         ?>          <?php $wp_query = null; $wp_query = $temp; ?> 
How can I hardcode the Nextpage tag into a Wordpress theme file?

82 out of 100 based on 57 user ratings 752 reviews