Used on single post permalink, this template tag displays a link to the next post which exists in chronological order from the current post. This tag must be used in The Loop.

learn more… | top users | synonyms

2
votes
3answers
122 views

How can I limit the length of the previous/next posts in my Wordpress Theme?

I am using the following code to show next/previous posts in my wordpress theme. <?php previous_post_link('<span class="left">&larr; %link</span>'); next_post_link('<span ...
0
votes
0answers
14 views

Transfer custom post nav (prev/next) from one to another theme

I bought two themes and just want to assume a special next/prev post navigation from the first theme in the second theme. I've searched the theme files and found the function, which declares this ...
0
votes
0answers
27 views

Conditionally (cpt) filter previous and next_post_link

I'm using the next_post_link and previous_post_link functions in two different scenarios, first in my single-cpt.php and second in my single posts. The name of my cpt is "members". Note, that I'm ...
-1
votes
1answer
13 views

Multiple loops using next_posts_link & previous_posts_link

I have more than one loop in the same page and they are working perfectly, but the problem comes up when I try to use next_posts_link & previous_posts_link for a specific div. Example: <div ...
1
vote
3answers
886 views

Problem excluding category from get_next_post

I have a custom post type called "exhibitions" that uses the native "category" taxonomy. I have three categories: Current, Past, and Featured. Posts get marked either Current or Past and some are also ...
0
votes
0answers
89 views

get_adjacent_post - in same term or category not working

I am building a Next and Previous Post navigation for my 'Single post' pages, inside a plugin. What I am trying to do is get the Prev/Next post within the same category of a Custom Post Type. So I ...
0
votes
1answer
377 views

Add Previous/Next Buttons to CPT Single Pages Only

I'm working with a site that is displaying a portfolio CPT on the home page in a "Grid Loop." On the single pages, i'd like to add Previous & Next Item buttons. I thus added this code: function ...
0
votes
1answer
866 views

get_adjacent_post - in same term not working

All I want to do is link to the next post in the same category, and for the life of me I can't see what's wrong with my code. Does in_same_term work for everyone else? <?php $prev_post = ...
0
votes
0answers
22 views

Display an advanced custom field inside next_post_link_plus

I'm using Ambrosite Next/Previous Post Link Plus on my website. I've been able to customize my links on my website, but I can't find a way to display a field from ACF in my links. I would like to ...
1
vote
2answers
1k views

Exclude Posts From Specific Category from Next and Previous post links

I've been searching for this a lot...but all I get is not what I need. I simply want to show next and previous links on single.php (from all the categories, based on publish date, not just in the ...
0
votes
1answer
40 views

Single: Prev and next Post in same order as main query, in all categories

I am using something like these arguments to order the archive loop, to order posts by a custom field. $args = array( 'category_name' => $filter_cat, 'posts_per_page' => -1, ...
0
votes
0answers
49 views

WordPress prev next button in frontpage

Hi I have working pagination but if I'm using in static/frontpage prev and next button not showing or not working properly. If I add max num pages in next button it's showing but always going second ...
0
votes
1answer
69 views

Next and Prev post link breaks code on last post

I have a problem with the following code snippet that I found and adapted. Works well, except for the last post...as the last post does not have a "previous" post, this seems to bring up a problem ...
-1
votes
2answers
588 views

Can't get the previous and next posts permalink

I tried to get the next and previous URL, and create a navigation. But it seems to only retrieve the permalink from the two first posts (but not the others recents posts). I have 5 posts (ID = 25, ...
0
votes
1answer
478 views

The next_posts_link() show me a aditional page in blank

The description Hi, I am using a custom post type and a loop through the values ​​I show. I'm using a term ($ term) that comes from a previous page in the loop to only show related items. Just for ...
0
votes
1answer
37 views

Get ID for previous/next image link

For grabbing previous or next image link on attachment page we can use this https://codex.wordpress.org/Function_Reference/previous_image_link How do we get ID for that attachment? Because I would ...
0
votes
0answers
53 views

How can I use previous and next posts links for each SET of children in a custom post type?

I have a custom post type set up with the Custom Post Type UI plugin called 'Exhibitions'. There is a parent post for each exhibition (eg: Exhibition 2011, Exhibition 2012) and under each is a number ...
4
votes
1answer
1k views

How to get next and previous post links, alphabetically by title, across post types, in a shortcode

I need next and previous post links in a single post page using a "page-builder" type of CMS—specifically the DIVI theme by Elegant Themes. So, I need the links to be able to appear using Shortcodes, ...
0
votes
0answers
400 views

Next/Previous Post Links in single-[custom-post-type].php file

I have a post type 'location' that is a listing for each branch of a multi-branch company. I want to add a Left and Right arrow on each individual location post that will allow the users to cycle ...
2
votes
2answers
238 views

How to show next Post Thumbnail image in WordPress using current post id

i make a wordpress theme i make a grid structure show below i have this grid structure it contain two rows and every row has three column i want to show my wordpress random posts in this grid ...
1
vote
1answer
190 views

Next/Previous Posts Links: Alphabetically and from Same Category

I'm exhaustively searching for a method to provide Next and Previous Post Links in a different way from which it usually appears in Single Post. By DEFAULT it: Is chronological ordered Links to ...
1
vote
1answer
187 views

get_next_post_link() and get_previous_post_link() return wrong posts

I'm using get_next_post_link() and get_previous_post_link() within the loop but the returned posts are not correct. get_next_post_link() shows the previous post and get_previous_post_link() gives the ...
2
votes
1answer
319 views

next_post_link and previous_post_link in custom post type single page, in same non-custom category

I have a custom post type "realisation", for which I've made a file single-realisation.php. These posts use the non-custom taxonomy "category". In this page, I use the next_post_link() and ...
0
votes
1answer
146 views

Modify previous and next post links to current Authors Other posts

I have created custom post type gallery. How change the previous post and next post link to point to the current Authors posts only? The Previous and Next Post link should not display if there are ...
0
votes
1answer
30 views

WordPress not showing pagination links

In my WordPress Index.html I am pulling out the 3 latest posts by using <?php query_posts('posts_per_page=3') ?> <?php while(have_posts()) : the_post(); ?> //rest of the post related ...
0
votes
0answers
70 views

Next_post_link not working when I try to change text

I am using the following code to navigate through posts within a custom post type. Which is working absolutely fine. <div class="prev-item"> <?php previous_post_link(); ?> ...
0
votes
1answer
46 views

Tweak next_post_link for it to include thumbnail

I am using a fork from underscores.io, and there is this code: next_post_link( '<div class="nav-next">%link</div>', _x( '%title <span ...
0
votes
0answers
96 views

Problem with pagination in custom loop on front page - no back link

I have certain problem: I have several queries on main page. When I call new WP_query on front Page (custom loop in main loop), make custom pagination, but it doest work in case if I want "Previous / ...
-2
votes
3answers
170 views

Next Post Link not working with parameters to restrict to same term

I am using next_post_link() , and I want to use the parameters shown in the documentation to restrict it to go to the next post with the same term for a custom taxonomy called "years". The line I am ...
0
votes
0answers
65 views

How to exclude categories as well as their respective thumbnails from custom prev-next navigation?

I added the following to my functions.php file: function wyrta_post_nav() { global $post; $exclude_cats = "8"; // Don't print empty markup if there's nowhere to navigate. ...
0
votes
2answers
142 views

Pagination for custom loop on custom page template is not displaying anything

I have created a page where user can see his favourite post which has been bookmarked by him get_user_favorites($user_id); This function is responsible for returning me all the favourite posts ...
4
votes
1answer
255 views

How can I get next/ previous post links to order by a filter (by the last word of the title)?

I am trying to use the next/ previous post link functions by Wordpress to move between posts of a custom type based on the surname of a person. The custom type represents a person with a post title ...
0
votes
1answer
88 views

WordPress “Next Post” URL and Thumbnail

I am a noobie. Building my new theme. I just need to get 3 separate data: $image = direct link to the next post thumb image (just the link) $name = Next post name $url = Next post URL Looked at ...
0
votes
1answer
676 views

How to get Next/previous_post_link to go through articles in top parent category

I have a magazine format where a parent category is an issue, sub categories are the sections and the articles go into their respective sections. When viewing an article in a magazine, I would like to ...
0
votes
0answers
259 views

Loop Wordpress Next and Previous Post

I have a next and previous post link in Wordpress but if you're viewing the very last post or the very first post you get a blank space where no other posts meet the condition. How do I edit my code ...
3
votes
1answer
355 views

next and previous post link ordered alphabetically

I found a snippet, which order all posts alphabetically. I wonder if is there a way to make it working just for one post-type? I have some custom post type in my website, and i want one of them to be ...
0
votes
1answer
189 views

How to exclude or filter password protected posts when using next_post_link() previous_post_link

I'm using next_post_link() and previous_post_link() in my theme. I excluded my password protected posts from the loop. They only appear if you enter the URL of this specific post. But, the problem is ...
0
votes
1answer
43 views

Adding a space between next and previous post links

i've been struggling with this for a while but i can't seem to make it work.So i wanna add a space between my next and pervious post link right now it looks like this : Here's a pastebin of my ...
0
votes
1answer
72 views

Next post in category

i tried to make my previous/next to move only for one category,but i can't seen to make it work... http://pastebin.com/kDECBeKE this is a pastebin of my template-tags.php where i have my ...
0
votes
1answer
135 views

Next/Previous post navigation

Hey guys i want to make my next and previous links to work just for a category not all of them togheter,so when you get on the last post from that category to stop,right now it's still going in ...
18
votes
6answers
8k views

Can the Next/Prev Post links be ordered by menu order or by a meta key?

I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary. The next/prev post links (generated by next_post_link, previous_post_link, or ...
0
votes
1answer
83 views

Need help with get_posts pagination

I've been working on a wordpress site, and I'm trying to build a page where visitors can see all of the images that have been uploaded to the wordpress media gallery, regardless of whether or not said ...
-2
votes
1answer
1k views

Next and prev. post link ONLY within category

Im using the next post link function of WP to show next and previous navigation links to the "next post in same category" all good with this...the issue i have is that when I'm in the "last" post of a ...
0
votes
1answer
79 views

Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )

Is this possible? How can i change the query for adjacent posts and add 'post_status=future' to display next and previous posts for scheduled ones? I suppose i should use some kind of filter, but ...
0
votes
0answers
205 views

Next/Prev category post in same button

i like to put a navigation link in my posts, can you help me? How can do this? http://prntscr.com/64ksjd I've this code but, it show 2 hiperlinks, i want 1 hyperlink: $post_id = $post->ID; ...
1
vote
4answers
3k views

Next and previous link in custom post type in the same taxonomy term

I have a custom post type name->('portfolio'), with a taxonomy name 'portfolio_category'. What I want is to add next and previous links on its single page file which is single-portfolio.php. When ...
1
vote
1answer
105 views

Add #anchor to next/previous_post_link

I have tried to figure out to change the previous_post_link by following the Codex but I can't figure it out. Same for the next_post_link. I just want to have a simple link but with an #anchor tag ...
0
votes
3answers
2k views

Next/Previous links doesn't work in the same category

I created a category and call it "Blog". Then I created some posts and assign "Blog" as category for the posts. So I'm trying to go to previous/next into the same category and doesn't work. Here is my ...
1
vote
1answer
79 views

next_post_link for CPT only working for a few posts? weird!

I have about 20-30 posts in a CPT, and when I click on a single post and use the next_post_link and prev_post_link functions it will only show a select 5 posts out of the 20-30... always the same 5 as ...
0
votes
1answer
144 views

Pagination Links Not Showing Up on single.php posts on iOS Devices

So I've been working on my portfolio site for awhile now and just pushed the first "ok to be live version" last night. I gave it a quick QA and found some bugs that I am aware of, but the one that is ...