Custom Query Paginate (Page Navigation)
-
Below I have code that I have pulled from several sources
How can I tie my custom query into the page navigation? All I want to do is have a custom query that allows me to have 4 post per page. With a page nav at the bottom to get to each page containing the post.
Here is a link to my page: https://gods-image.com/news-2
<?php query_posts('cat=1&showposts=4'); ?> <div id="content"> <?php if (have_posts()) : ?> <?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> </p> <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(); ?> </div> <p class="metadata">Posted by <?php the_author() ?>.<?php edit_post_link('Edit', ' | ', ''); ?></p> </div> <?php endwhile; endif; ?> <?php global $wp_query; $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 ) ); ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Custom Query Paginate (Page Navigation)’ is closed to new replies.