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
0
votes
1answer
752 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
986 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(); ?> &...
1
vote
2answers
968 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 ...
33
votes
10answers
20k 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
0answers
18 views

Customizing a navigation bar with featured images

I wish to improve upon this piece of WordPress code where I have created a navigation bar with previous/next posts and a featured image included. I am using this code as part of a Discography feature (...
0
votes
1answer
21 views

Infinite looping next post link within a certain category on a post

I'm looking to create an infinitely looping 'next post' link at the bottom of a post that only links to posts in that category. So if I have three posts in the same category – 1, 2 and 3 – it should ...
0
votes
1answer
462 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, ...
1
vote
0answers
14 views

Get Prevous/Next Post Specific Category Without Excludes

Is it possible to mimic the get_next_post / get_previous_post WP functions without using the $in_same_term boolean / $excluded_terms array pattern? I have a site with many overlapping categories that ...
0
votes
1answer
555 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
2answers
808 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
2answers
609 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 ...
0
votes
1answer
529 views

Post in multiple categories do not include in previous / next post if one category in excluded

I have read the following post which appears to solve my problem but doesn't... excluded_categories parameter in next_post_link() behaving unexpectedly I have posts in say 3 categories but if they ...
0
votes
0answers
28 views

Why next_posts(); function does not work inside header.php?

Why does next_posts(); function does not work inside header.php whereas it ^does work^ inside temlate-homepage.php ? My code below: <?php // Query ALL posts ordered by random $args = array( '...
0
votes
1answer
560 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
0answers
21 views

Next/Previous Links: Alphabetically and from Same Taxonomy for my CPT Only

I'm looking for a way to set Next/Previous links alphabetically and from same taxonomy for my custom post types. So I've found this questions: https://wordpress.stackexchange.com/a/204270/182104 It's ...
1
vote
3answers
24k 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
0answers
17 views

Next and Prev Post for sub or child category at single-page?

I have category-country.php page and also I have single-country.php where i need to place a next and prev post with in same country that I have different project at country category having USA, China, ...
3
votes
1answer
2k 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 ...
1
vote
0answers
25 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
28 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
20 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 ...
2
votes
1answer
2k 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 ...
3
votes
4answers
11k 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 ...
0
votes
3answers
2k 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
0answers
45 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
26 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
331 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
89 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 ...
2
votes
1answer
26 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
75 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
66 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
25 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
115 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
1answer
276 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
126 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
1answer
93 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, ...
1
vote
2answers
1k views

get rid of the arrow in previous_post_link?

How can I hide or disable this « sign in front of previous_post_link? I can't find it anywhere - it only shows up on the generated page. This is the code I am using: <?php $nextPost ...
0
votes
2answers
2k views

Disable “previous link” in first post and “next link” in last post

how can I disable "previous link" in first post and "next link" in last post? thank you
0
votes
1answer
42 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
122 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
2answers
311 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
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 ...
3
votes
3answers
2k 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
1answer
2k views

Featured Image Link to next post?

Hello i wonder if anyone knows this is possible? A post featured image click to view next post...? For example.. <a href="next-post"> <?php the_post_thumbnail('post-thumbnails'); ?> &...
3
votes
7answers
12k views

Prev/Next child navigation for current page?

How can I get a Previous / Next navigation that only navigates the child pages of the current page? By that i mean url.com/page/child1, url.com/page/child2 and so on.. I've been searching around ...
0
votes
1answer
34 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 ...
3
votes
2answers
2k views

Why is previous_post_link and next_post_link working outside of the Loop?

This is my single.php file: I'm using previous_post_link(); and next_post_link();. In the Worpress codex it says that it only works inside the loop. <?php /** * The Template for displaying all ...
0
votes
0answers
209 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
2k 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 ...