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
- I cannot get tax_query in get_posts() to work with custom taxonomy
- Related Posts with removing some categories
- how to show more than 1 post into three columns query
- Getting the last X posts, but in ascending order of time
- WordPress custom query by archive title
- pre_get_posts with WP_Query to prevent posts from specific tags
- how to get dynamic data on wordpress from codeigniter?
- How can I modify standard search query to include also ACF custom fields values?
- Meta key in wp_query bug?
- Using something else instead of using 9 wp_query
- make query more simplest and in one query
- Show All with Isotope
- display all posts from category with and without terms in chronological order
- How to display post based on which is clicked
- date_query problem
- Help displaying related categories
- WP_Query Not Working with Variable
- WP_Query doesn’t works inside loop
- How to Navigate within Category? Lot of codes here on stackexchange didn’t work
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- A very strange problem with search query
- How to create page that lists tags by initial letter?
- WP_Query doesn’t return some child pages even though the database shows them
- Seach and categories not working when ignoring sticky posts in main loop
- query_posts based on a meta_key
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- I need to customize wordpress “previous” “next” links
- How to redirect a query string to a “virtual” subdirectory
- posts_per_page increment additional post
- Custom WP_query and integrating into theme file
- WP_Query returns images but post_per_page is incorrect
- Query by Category and Custom Field – Shortcode
- How to show all the associated posts with specific date of data metabox?
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Track write actions to the database
- WP Query issue for multiple values
- WordPress wp_query add custom query as field
- Custom query return
- Display three sequential posts on each page load, without repeating previous
- How can I use two custom fields in WP Query
- Pull posts from all categories if quantity is not met?
- Calling a function with WP_Query only ever brings the first result
- Get a page ancestor from a most viewed list
- How can I use a specific wordpress page template if certain words are used in page title [closed]
- What argument does my function need to echo get_results() query results
- wp-query with a tax-query relation of NOT
- Custom query using WP_Query is not working
- Query_post 5 post first / last of post_id
- get last child post by wp_query
- Show subscriber id in loop
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Featured Image as Background with Offset
- WP_Query don’t working with fixed post_id and term_taxonomy
- custom WP_Query results in showing same posts in all pagination pages
- Calling body_class and wp_nav_menu for a different post
- Category Archive not working for pages
- Navigate to external link if last page or post in a category
- View related categories in order of posts
- Rewind posts then show only first post
- modifying the loop multiple times with arguments passed through ajax to wp_query
- query only returning posts with already set custom field
- counting post from a wp-query using sticky_post
- WP_Query – show posts where meta value and user_email match
- WP_Query causing links to not work