Add a “Next Post” & “Previous Post” styled button manually to a post

This is standard WordPress functionality, contained in previous_post_link and next_post_link. You don’t need to edit functions.php. Just add to your template: <div class=”buttons”> <span class=”previous-button”><?php previous_post_link() ?></span> <span class=”next-button”><?php next_post_link() ?></span> </div> Now you can style the buttons with css. Follow the codex links for customizing options to the functions.

Footer with next/previous posts

Maybe I don’t understand the question, sorry in that case. But can’t you just retrieve the last 6 posts excluding the current? Something like: global $post; $footer_posts = wp_get_recent_posts( array(‘post_status’ => ‘publish’, ‘posts_per_page’ => ‘6’, ‘exclude’ => $post->ID), 1 ); if ( ! empty($footer_posts) ) { foreach ( $footer_posts as $post ) { setup_postdata($post); echo … Read more

get next/previous post name

$prev = get_previous_post(); $next = get_next_post(); $prev_title = $prev ? get_the_title($prev) : ‘Current is First Post’; $next_title = $next ? get_the_title($next) : ‘Current is Last Post’; See get_previous_post and get_next_post on Codex for some details and additional params you can use.

Add next and previous post links on pages like category, tags or archive pages

Two problems I can see off hand here Firstly, you should move your query to outside your if conditional statement. Secondly, when using WP_Query, the $max_pages parameter should be used when using next_posts_link( $label , $max_pages ); So, your code should look something like this <div class=”wrapper inner_content_wrap”> <?php next_posts_link( ‘<span class=”label iconfont”><img src=”‘.get_template_directory_uri().’/images/pager_arw.png” alt=””></span><span … Read more

Category foreach Paging

I figured it out! After a lot of research and trial and error, I managed to figure out how to get the paging to work for both versions…my original code and the simplified code update. Original Code Solution: <?php $cat = get_cat_ID(“Photos”); $categories = get_categories(“child_of=$cat”); $limit = 9; $total = count($categories); $pages = ceil($total / … Read more

Display NEXT and PREVIOUS pagination? [duplicate]

get_previous_post() and get_next_post() are deprecated. You should use get_previous_post_link() and get_next_post_link() or even better the wrapper functions the_post_navigation() or get_the_post_navigation(). If you don’t know how to use them, see the single.php template of the twentyfifteen theme that comes with WordPress by default. You can also see how these functions are implemented in the link-template.php file … Read more

WordPress template next_prev

See: https://codex.wordpress.org/Function_Reference/previous_post_link I’m a little confused by what you are asking but I’m assuming you are after the next/prev links to go to the next or previous post in the same category? In which case, you need to define the third argument in ‘previous_post_link’ & ‘next_post_link’ as ‘true’. Note that those two functions must be … Read more