Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [next-post-link]

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.

57 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
339 views

WordPress previous_post_link exclude posts with multiple categories

I have a single-news page in WordPress where I am looping over all the posts and conditionally updating the previous and next buttons to exclude certain categories based on the current post's category ...
3
votes
0answers
410 views

Post in Multiple Categories to stay in current category (permalink, next previous post link)

I guess this has been mentioned before, but after 2 days of browsing i haven't find a complete solution. Maybe someone has come across this problem before? I'm building a designer portfolio where ...
2
votes
1answer
208 views

connect last post with first post

next/prev from my first to last and the other way around cant find a solution for that i am using this code for next <?php next_post_link('%link','<img src="img-location"/>'); ?> and ...
1
vote
1answer
153 views

previous/next_post_link in the same sub-category?

As the title: is there a way to navigate between posts of the same subcategory using the previous_post_link and next_post_link functions? But maintaining however both the category and the sub-category ...
1
vote
0answers
55 views

Using 'previous_post_link()' & 'next_post_link()' on single attachment pages

I have uploaded a selection of audio files via the media uploader. I can successfully open an attachment page (single.php) for each file. However, the 'previous_post_link()' generates the current ...
1
vote
1answer
402 views

Previous_post and Next_post - Custom Post Type

I have a custom post type and using this function to add for posts, previous and next buttons. The problem is that within the custom post type, I have subcategories defined by a custom field ...
1
vote
0answers
60 views

posts_nav_link(); picks up index.php instead of category.php as template

My index.php and category.php pages are different especially in regards to query_posts function. Both themselves works fine, however when I navigate to "Next Page" via posts_nav_link();, index.php ...
1
vote
1answer
88 views

Next Posts Prev Posts for Standard post format only

I am using the following functions in my single.php file to display links to Previous and Next posts: get_next_post(); get_previous_post(); I store them in 2 variables: $next_post = get_next_post();...
1
vote
0answers
973 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 ...
1
vote
2answers
864 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 ...
1
vote
0answers
145 views

next/previous links on custom post single a little screwy

Working on a custom post template, using next_post_link and previous_post_link. And they do -- EXCEPT on the most recent post: where next and previous both point to previous. Which is...confusing. ...
1
vote
2answers
231 views

Pass taxanomy parameters to next_post_link()?

I am trying to find out if it is possible to pass certain parameters to next_post_link() and previous_post_link() to make it only show other custom posts that have the same custom taxonomy values ...
1
vote
1answer
370 views

Get Adjacent Post By Tag

In this answer -- How to Get Next or Previous Post in a Specific Tag? -- a working function is provided to generate "next/prev" links by tag rather than category. How could one make this so that you ...
0
votes
0answers
5 views

Next/Previous Posts Links: Product Order 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 ...
0
votes
0answers
16 views

Wordpress Exclude post in next_post_link function

I have very long posts so they have to be divided into two parts, which means two posts on one topic. The second part must be hidden from the eyes. I have a post ids to exclude. Is it possible to do ...
0
votes
0answers
18 views

Change URL of previous posts and next posts link in Wordpress

I'd like to change the URL of the <?php previous_posts_link ?> and <?php next_posts_link ?> that are being outputted by Wordpress. Problem: When I am on my single page, I am getting ...
0
votes
1answer
118 views

Get previous/next post from (specific) category

I have posts with two categories, for example, 1st post is in category "product" and "shoes", 2nd is in category "product" and "shirts", 3rd is in category "product" and "sport clothes"... So, posts ...
0
votes
1answer
46 views

Next/previous post link to posts only within one or more specific categories

I have posts that are in multiple categories. I am showing a next/previous post link on posts that are in a specific category, regardless of how many other categories this post has. The links are now ...
0
votes
0answers
22 views

Excluding terms from next_post_link when post is in more than one category

I am working on a art gallery template that has a custom post type of "paintings". Each painting can be in a different custom taxonomy category "paintings-category" such as "studio", "plein air", and "...
0
votes
0answers
25 views

How to use get_{$adjacent}_post_where

I am new to php. I have a wordpress site in which I have setup a custom field show_post of type True / False. I want to use previous_post_link and next_post_link, to only showing posts that have the ...
0
votes
0answers
17 views

Set Adjacent Post By Alphabetical Order for Custom Post Type in Multilingual Site

In order to apply chronological order with posts and alphabetical order with a certain Custom Post Type, let's say, "animals", displayed through a single-animals.php template, I found this snippet ...
0
votes
0answers
58 views

Using previous_post_link next_post_link but with a filter on a custom field

I have a wordpress site in which I have setup a custom field show_post of type True / False. Lets me control showing of posts of course. But I can't figure out in php when using previous_post_link ...
0
votes
0answers
32 views

get_next_post() not working with future post status

I'm using in single post template simple navigation below the post content: $next_post = get_next_post(); if($next_post) { $next_title = strip_tags(str_replace('"', '', $next_post->...
0
votes
1answer
76 views

how to overwrite next_post_link

Is there any custom php code that lets me overwrite next_post_link so I can customize it to my liking? I can add code in functions.php Right now it shows next post But I want to show something else
0
votes
0answers
48 views

next_post_link() and previous_post_link() in single-cpt.php file not working

I am trying to display links to previous post and next post in for a custom post type regardless of whatever custom taxonomies they are attached to. I have a custom post type called experiencecont ...
0
votes
1answer
45 views

make random internal linking in the middle of posting

i mean like in the middle of the article, i will put a link that link to a random post in my website. i'm new with this thing. and i'm trying to find a solution, because i've tried with a plugins, ...
0
votes
1answer
33 views

Dynamic next and previous post links

Is there any way to change the next and previous post links dynamically. By default the previous post link takes to the previous post. However I want it to link to some different post, that I posted ...
0
votes
1answer
23 views

Back, Next, and Previous links for the REFERRING term archive

I have a bit of a tricky one. I can figure out how to do back, previous, and next links for a specific taxonomy term, what I can't figure out is how to specify which term the user started viewing ...
0
votes
0answers
181 views

get_previous_post_link and get_next_post_link of custom post type that share custom field value

I have a custom post type called chapter. I'm trying to show the next chapter with something like the get_next_post_link() and get_previous_post_link(). I get the next chapter that is posted, but I ...
0
votes
1answer
404 views

Previous/Next custom post links within custom taxonomy

I have seen this issue in quite a few threads so apologies if I've replicated an issue here but I've had no joy in attempting to implement the solutions I have found. I have a custom post type: show, ...
0
votes
2answers
662 views

How to filter get previous post function by meta value DESC and post date DESC?

My loop displays featured posts and then posts in reverse chronological order. However when I use <?php echo get_previous_post(); ?> it grabs posts in reverse chronological order. How do I ...
0
votes
1answer
820 views

previous and next post of same category on singlepost.php

I want to show previous and next posts of same category in wordpress My code is : <?php $prev_post = get_previous_post(); $next_post = get_next_post(); ?> &...
0
votes
1answer
81 views

How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?

I want to add "previous" and"next" to the individual blogs since they only have the blog titles for the next and previous links. I want to keep the links and I am having a hard time using any of the ...
0
votes
0answers
13 views

Why is one of my posts prefixed with “Next Post” on Google search

I run a website on WordPress.org and at the bottom of each post are two links that point to the previous and next post. I was doing a Google search on one of my website's posts and it showed two ...
0
votes
1answer
36 views

How to change the wording of front-end `next article` for custom type registered in a plug-in?

I am working with another developer on a plugin that register and defines a custom type of posts. It's working as intended in the back-end but I would like to change the wording of next article and ...
0
votes
0answers
186 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 ...
0
votes
0answers
3k 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 ...
0
votes
1answer
720 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
1answer
167 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 ...
0
votes
1answer
124 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 ...
0
votes
0answers
477 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; //...
0
votes
0answers
269 views

Show prev and next post links for parent post of current image in attachment page?

I use this code to show previous and next posts (in same category) on post pages (single.php). <?php $next_post = get_next_post(TRUE); // TRUE = in same category if (!empty( $next_post )): ?> &...
0
votes
2answers
284 views

Next/Previous links in custom taxonomy, where item may belong to multiple terms

I have a CPT of 'Projects' and a custom taxonomy term tied to that called 'Sections' (basically the same as 'categories' I just find it clearer to use a different term name on a CPT than on standard ...
0
votes
0answers
986 views

using next-page and previous page inside a wp_query

I'm using a wp_query on my website to display a list of child pages from a parent page. It works fine and my pages are sorted by a meta_key using a custom field. Now I would like to add a next page (...
0
votes
1answer
551 views

Add anchor tag on previous_image_link / next_image_link

I am using big headers on my website.I need the next/previous_image_link to target to the picture , not the top of the page. Is it possible to add anchor or to set the target on next/...
0
votes
1answer
513 views

Next / previous posts link doesn't show up with Posts 2 Posts

I am working on a Wordpress project where I use the Posts 2 Posts plugin to show posts from one post type to posts from another post type. This works great but for some reason my next_posts_link() ...
0
votes
0answers
596 views

previous_posts_link returns null when querying custom post type

I have created a custom post type named lesson, and I want to display all lessons, so I created a custom page named lesson.php, inside, I added a query to look for all the posts which type are lesson. ...
0
votes
0answers
220 views

next_post_link and previous_post_link order not working properly

Very strange problem, i have uploaded lots of photos and made posts for each of them so i have them in order 1 to 120. I have used next_post_link and previous_post_link in my loop eg. <?php if ( ...
0
votes
0answers
138 views

Next Post Link in format

I'm after a wordpress function that can give me the link to the next post with the same format as the current post. I've been looking and struggling to find one. I expected to find an option similar ...
0
votes
1answer
40 views

Tags interfering with next_post_link();

I am creating a theme in WordPress. I am using query_posts('tag=front') to limit the posts on the front page. However, I want to let the user navigate through all posts, regardless of tags when on ...