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.

Filter by
Sorted by
Tagged with
1
vote
0answers
22 views

Show category from “Next post” and “Previous post” [edited]

Posts are marked in a level 3 category. For example: City (which has the upper categories: State and Country). - Country -- State --- City I would like the level 2 (State) category to be shown along ...
0
votes
0answers
27 views

Show category in Previous/Next links

In place of the word PREVIOUS and NEXT, I would like to display the level 2 categories of the respective posts. This is my current code: function twentyfourteen_post_nav() { $previous = ( ...
0
votes
0answers
6 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
20 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
140 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
52 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
23 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 "...
2
votes
1answer
21 views

Working with Next and Prev links in Single Taxonomy Templates

I am building an art gallery website using a custom post type "paintings". There is a custom taxonomy for categories called "painting_cat" where it can be "studio", "plein air" etc., and another ...
0
votes
0answers
26 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
20 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
59 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
35 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->...
1
vote
2answers
18 views

Restrict next_post_link() to current category

The Codex disagrees with itself, so I'm stumped. On single.php I am trying to use next_post_link() to display a link to the next post, with custom link text, within the same category as the current ...
1
vote
1answer
163 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 ...
0
votes
1answer
80 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
50 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
50 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
99 views

next_posts_link not visible on first page

I cannot get the <?php next_posts_link(); ?> working in my custom post loop on the first page ( website.com/news). The funny thing is that <?php previous_posts_link(); ?> does work on the ...
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
3answers
863 views

next_posts_link not working in custom loop

I've created a custom loop for posts, that works with Bootstrap, in which, I've added pagination - however it doesn't seem to be working. It just shows an empty button... <?php $args = array( ...
0
votes
1answer
31 views

Wordpress next/prev links Issue

previous_post_link(); next_post_link(); this code should display previous link and then next link , its showing totally opposite , is this wordpress issue or this is something me doing wrong
-1
votes
1answer
19 views

Exactly where I have to insert get_next_post_link() in a post?

Currently I'm working on a website, where there are posts and I intend to give the possibility the user to jump to the adjacent posts with a simple link pointing to them. It will be with ...
0
votes
0answers
183 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
2answers
1k views

Can I use get_adjacent_post for specific categories?

I want to get next and previous posts based on a particular category slugs. For example, some posts might have the "sports" category while another has the "tech" category. I was hoping to plug in a ...
0
votes
1answer
410 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, ...
3
votes
1answer
4k views

How can I get next post id after current post id for custom post type

Hello I am using WordPress custom post type. In this I need to get the post id of the next post which will be present in the custom post type. The issue I am facing is that this post id will be ...
0
votes
1answer
88 views

How to know if the most recent article

I would like to know how to know if the next article is the most recent ? And if is not the most recent, dont' show the content (The right arrow and "Article suivant") please, Here is my current code ...
0
votes
2answers
670 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 ...
1
vote
1answer
1k views

How to make my pagination loop continuously?

So I created some custom pagination for my single.php template to show next/previous posts at the bottom. However, the way it is working currently is linear(ie on the most recent post there is only a "...
0
votes
1answer
839 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
153 views

Wordpress post next/prev not working

I'm trying to add next/prev links to my wordpress post. This is the code for it: <div id="demo"> <?php $the_query = new WP_Query( array( 'category_name' => 'Case Study', '...
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 ...
0
votes
1answer
82 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
1answer
665 views

Get next post in same category not working WP 4.7.4

I have posts which assigned 1 of 2 different categories. On the single post view i want to show a next and previous link of posts with the SAME category. This should be straightforward, i've tried ...
2
votes
1answer
219 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
422 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
2answers
112 views

Previous/next post links displaying wrong category than is desired

I want my single.php to display posts in the same category for the previous and next posts underneath the post. The problem is that each of my posts belongs to multiple categories, and they are ...
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
43 views

How to Navigate within Category? Lot of codes here on stackexchange didn't work

At present I am using the below code to navigate between previous and next post. <?php global $wp_query; if (is_single()) { ?> <div class="prev-navigation"> <?php ...
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 ...
0
votes
1answer
80 views

I need to customize wordpress “previous” “next” links

I am a hubspot developer mostly, and hubspot has tokens for previous post link and previous post title, and the same for the next post and the images for these posts. You can use these to create ...
0
votes
2answers
730 views

Displaying the author of next and previous posts in pagination?

I have set up links to the next/previous posts on my single.php template. Currently I am using <?php previous_post_link(); ?> and <?php next_post_link(); ?> which gives me the title of the ...
0
votes
1answer
141 views

altering %title

I'd like to transform the result from %title in functions like next_post_link(). More specificaly, I created a function called short_title($title, $after, $length). The idea is to return the title ...
3
votes
1answer
341 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 ...
1
vote
1answer
90 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();...
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
1answer
188 views

How do I use the add_query_arg function in a template tag like previous_post_link?

I am trying to change the output of the previous_post_link and the next_post_link and basically add a query argument to them. The documentation just mentions that you can use the %link placeholder ...
3
votes
3answers
1k 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 class="...