Previous_post and Next_post – Custom Post Type

You want to change the in_same_term value to TRUE as follows: function crunchify_post_navigation(){ ?> <div class=”arrowNav”> <div class=”arrowLeft”> <?php previous_post_link(‘%link’, ‘&#8606;’, TRUE); ?> </div> <div class=”arrowRight”> <?php next_post_link(‘%link’, ‘&#8608;’, TRUE); ?> </div> </div> <?php } add_action(‘wp_footer’, ‘crunchify_post_navigation’);

Restrict next_post_link() to current category

OK, so there’s a problem with Codes in this part, I guess. The Codex article on Next and Previous Links contradicts the article specifically on next_post_link() In that article you can clearly see, that it looked a little bit different. In the part describing next_post_link there is a note: Deprecated: previous_post() and next_post(). Use: –> … Read more

Add #anchor to next/previous_post_link

This seems to do the trick: add_filter( ‘next_post_link’, ‘wpse_post_link’, 10, 4 ); add_filter( ‘previous_post_link’, ‘wpse_post_link’, 10, 4 ); function wpse_post_link( $output, $format, $link, $post ) { if( $url = get_permalink( $post ) ) $output = str_replace( $url, $url . ‘#anchor’, $output ); return $output; } i.e. appending the #anchor to the previous/next permalinks. ps: I … Read more

next_post_link() on custom menu structure

The function behind the function behind the function… next_post_link(); is a wrapper for adjacent_post_link(); which then calls get_adjacent_post(); where the 3rd argument is $previous and set to true/false to get the previous or next post. This gives you two opportunities: Use the output or the query filter. Output filter This might sound easier, but you’ll … Read more

WordPress “Next Post” URL and Thumbnail

You can use get_adjacent_post function for retrieving that data. This function retrieve adjacent post. Can either be next or previous post. For previous post <?php $prevpost = get_adjacent_post( false, ”, true, ‘category’ ); $image = get_the_post_thumbnail( $prevpost ); $name = get_the_title( $prevpost ); $url = get_permalink( $prevpost ); ?> For next post <?php $nextpost = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)