next_post_link
& previous_post_link
work off the global $wp_query
. You could simply overwrite the main query with $wp_query =& $query
, or replace your custom query with the standard ‘global’ functions.
<?php query_posts( array( "post_type" => "page", "page_id" => $post->ID ) ) ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post() ?>
<!-- do stuff -->
<?php endwhile ?>
<div id="footer_nav_container">
<div class="left"><?php previous_post_link(); ?></div>
<div class="right"><?php next_post_link(); ?></div>
</div>
<?php else : ?>
<!-- do other stuff here -->
<?php endif ?>
Related Posts:
- Pagination for custom loop on custom page template is not displaying anything
- WP_Query and pagination AGAIN?
- Change URL of previous posts and next posts link in WordPress
- next_posts_link not visible on first page
- using next-page and previous page inside a wp_query
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
- Pagination with custom SQL query
- How to use the_posts_navigation for wp_query and get_posts?
- WP_Query and next_posts_link
- How can I limit the length of the previous/next posts in my WordPress Theme?
- Problem excluding category from get_next_post
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Generate a tabbed submenu — from taxonomy term or submenu item — with sample content
- WordPress pagination link always leads to home page
- connect last post with first post
- Page navigation doesn’t show when query category
- Set if condition with wp_nav_menu
- Is it possible to nest get_previous_post()?
- previous/next_post_link in the same sub-category?
- get_adjacent_post – in same term or category not working
- twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade
- Issue with front page navigation after upgrading to 3.4
- Custom navigation : show posts in sets of 4
- How to get main menu only with wp_nav_menu
- Can’t get the previous and next posts permalink
- Next/Previous links doesn’t work in the same category
- How do I display a greyed out next_post_link when there is no next post
- Ajax (jquery) wp_query pagination returns -1
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- How to exclude posts by meta key value in the_post_navigation next prev links?
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- Dynamic next and previous post links
- Next / previous posts link doesn’t show up with Posts 2 Posts
- Post in multiple categories do not include in previous / next post if one category in excluded
- Previous / next posts using featured image thumbnail as links
- Resetting post data to previous loop in nested loops
- Order by multiple meta key and meta value [closed]
- Order by optional meta key?
- WP_query to get the first two latest posts, then another loop to get the next three
- Why is WP_Query not working with category_name?
- ‘Trying to get property of non-object’ when using WP_Query with ‘fields’ => ‘ids’
- Get attachment by slug
- RSS feed with specific keyword
- Get All IDs Of A Post Type Using WP_Query
- Group posts by custom field
- Multiple endpoints in one URL
- How to get the posts published in last two days using WP_Query?
- getting posts and number by specific meta value in multiple meta
- How to query using a combination of custom_field values?
- Get attached media only
- how to fire join query with post_meta
- Show one post per author and limit query to 8 posts
- Get term by custom term meta and taxonomy
- SELECT * FROM $wpdb->posts WHERE ID > 160
- How to show the posts of some category first, and then all other
- Custom Loop in Page Admin Causing Other Fields to Fail
- Pagination stops at page 6
- Paginated HTML Sitemap
- How to limit total number of posts in wp query loop?
- How to get posts on a specific date – WP Query
- WP_Query no posts with tax_query
- WP_Query with Metavalue
- My Main Query Modification is Messing up my dynamic main – why?
- Using Ajax to load more posts | Help me change the wording on my button to notify the user
- Get a post from other loop each n-posts in the main loop
- Search for multiple tags?
- WP_Query() and get_posts() can’t handle over a thousand posts?
- Sort by price woocommerce by ID post_meta
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- ACF Query Structure
- exclude product with available tag
- Need help understanding this WP Query [closed]
- Ordering posts by custom field and grouped by month
- relation OR instead of AND – Filtered term ID’s in loop
- filter posts by meta key with pagination
- Query to get result by Title or Meta along with tax_query parameter
- Oxygen Repeater Advanced Query
- Use dedicated functions
- Woocommerce Get Orders By Meta Value
- Pagination not working on archive.php template?
- Save large WP_Query to transient === false
- Using previous_post_link next_post_link but with a filter on a custom field
- WP_Term_Query->get_terms() very slow query for WordPress filter
- Multiple values in WP_Query : category__and
- Get all wp_users sort by metakey
- How to use wp_query in different column in single loop
- Paginated Post List on Front Page
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query – show posts where meta value and user_email match
- WP_Query causing links to not work
- Website goes slow down after importing long database
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Order posts by custom column using pre_get_posts
- wordpress nested loop
- Need help setting up a search form for wordpress [duplicate]
- Including ‘cat’ => $cat breaks meta_query
- problem in query_vars parameters
- Retrieving next_post_link() and previous_post_link() in functions.php
- First post outside of loop, homepage only?