Next/Prev category post in same button
Next/Prev category post in same button
Next/Prev category post in same button
previous_posts_link and next_posts_link are for archive page pagination, they both check if is_single is not true, so will not work on any sort of single post, page, or custom post type. use paginate_links instead or just manually build your pagination links.
solved my problem by removing <?php query_posts(‘posts_per_page=3’) ?> and tried limiting posts from Settings->Reading. Thanks
Next/Previous Post Links in single-[custom-post-type].php file
Conditionally (cpt) filter previous and next_post_link
previous_post_link and its sibling are pretty simple functions, so there’s not a lot to play with if you really want to use these (if you’re building a plugin and do not want to touch the theme, making you need a filter which isn’t there). However, since you’re talking about templates, I’m guessing that you’re building … Read more
Since it’s not clear exactly what you need it’s hard to give you the best solution. However … You should be able to use get_next_posts_link() in your loop template. Or get_previous_posts_link() if that’s what you want. If that returns null you can then echo a link to whereever you want in your template. if(!get_next_posts_link()) { … Read more
If I’m understanding this correctly, you may just want to use something like: $prev = get_previous_post(); $next = get_next_post(); Then to access the title you’d do something like <h1><?php echo $prev->post_title ?></h1> And if you wanted its image: $prev_img = get_post_thumbnail_id( $prev->ID ); <img src=”https://wordpress.stackexchange.com/questions/248644/<?php echo $prev_img; ?>” alt=”your alt here”>
Both previous_post_link and next_post_link accept a 3rd boolean parameter $in_same_term, which specifies whether link should be in a same taxonomy term. So in your scenario you would be looking to make the following update: previous_post_link <?php previous_post_link(‘%link’, ‘⟪ ⟪ ⟪ %title’) ?> updated to <?php previous_post_link(‘%link’, ‘⟪ ⟪ ⟪ %title’, true) ?> and next_post_link <?php … Read more
You can do this very easily using the_post_navigation. The WordPress reference page for it has more information. the_post_navigation( array( ‘prev_text’=>__(‘Previous: %title’), ‘next_text’=>__(‘Next: %title’), )); That said, if you do want to continue using `wp_link_pages’ then, again, its WordPress resource is your friend, explaining the parameters and how to change them. Hope that helps!