next_post_link() – how to add url parameter
next_post_link() – how to add url parameter
next_post_link() – how to add url parameter
The article you linked to already has a solution written by the co-founder of WordPress Mike Little: https://digwp.com/2012/05/post-navigation-author-category/#comment-36899 In the spirit of constructive criticism, the correct solution to this is in two parts: Firstly, the third parameter to previous_post_link() and next_post_link() is a flag to say keep the same category. Modify your theme (probably in … Read more
Wherever you want to place your image: <?php get_the_post_thumbnail( get_previous_post(), [ 150, 150 ] ) ; ?> <?php get_the_post_thumbnail( get_next_post(), [ 150, 150 ] ) ; ?> You can replace the sizes [ 150, 150 ] with the ‘thumbnail’. Edit: The code that works for me: $next_post = get_next_post(); $previous_post = get_previous_post(); the_post_navigation( array( ‘prev_text’ … Read more
I solved it by abandoning the code and registering a new taxonomy. I then used this code in single.php: <?php if (has_term(‘[TERM-NAME]’, ‘[TAXONOMY-NAME]’)) : ?> <div class = “next-post”><?php next_post_link(‘%link »’, ‘%title’, true, ”, ‘[TAXONOMY-NAME]’) ?></div> <div class = “prev-post”><?php previous_post_link(‘« %link’, ‘%title’, true, ”, ‘[TAXONOMY-NAME’) ?></div> <?php endif; ?> Doing it like this allows … Read more
Here’s a good place to start: http://codex.wordpress.org/Template_Tags/previous_post_link http://codex.wordpress.org/Template_Tags/next_post_link As you will see, keeping the links to posts of the same category is as simple as setting an argument in the function. I would give an example but there are really good examples on the pages linked above.
Ok this issue was very hard to get fixed. I finally found the solution: Above <?php if (have_posts()) : ?>: insert: <?php $max_entries_per_page = 0; $current_page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 0; query_posts(“category_name=mobiliario&showposts=1&paged=” . $current_page) ?> Bellow <?php endwhile; ?>: insert: <div class=”pagination”> <div class=”pagnext”><?php next_posts_link(‘—›’, $max_entries_per_page) ?></div> <div class=”pagprev”><?php previous_posts_link(‘‹—’, $max_entries_per_page) ?></div> </div> I … Read more
You should try Ambrosite Next/Previous Post Link Plus. It gives you the option of displaying multiple next or previous links among a number of other great options.
This should work. Wasn’t closed well <div id=”cooler-nav” class=”navigation”> <div class=”wpb_wrapper”> <h3>More Underwater Media</h3> </div> <?php $prevPost = get_previous_post(true); if($prevPost) {?> <div class=”nav-box previous”> <div class=”navig_thumb_wrapper”> <?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(100,100) );?> <?php previous_post_link(‘%link’,”$prevthumbnail”, TRUE); ?> </div> <?php previous_post_link(‘%link’,”<p>< %title</p>”, TRUE); ?> </div> <?php } ?> <?php $nextPost = get_next_post(true); if($nextPost) {?> <div class=”nav-box next” … Read more
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
Why is one of my posts prefixed with “Next Post” on Google search