In WordPress if you want to display the previous or next post link then there is a inbuilt functions for this next_post_link() and previous_post_link(). But these function displays the date with created date . Sometimes we need to display the post with title or may be with other parameter so i have modified the function to get the previous post with other parameters also . So here is the code hope it’ll help you .

function filter_next_post_sort($sort) {
    $sort = "ORDER BY p.post_title ASC LIMIT 1";
    return $sort;
}
function filter_next_post_where($where) {
    global $post, $wpdb;
    return $wpdb->prepare("WHERE p.post_title > '%s' AND p.post_type = '". get_post_type($post)."' AND p.post_status = 'publish'",$post->post_title);
}

function filter_previous_post_sort($sort) {
    $sort = "ORDER BY p.post_title DESC LIMIT 1";
    return $sort;
}
function filter_previous_post_where($where) {
    global $post, $wpdb;
    return $wpdb->prepare("WHERE p.post_title < '%s' AND p.post_type = '". get_post_type($post)."' AND p.post_status = 'publish'",$post->post_title);
}

add_filter('get_next_post_sort',   'filter_next_post_sort');
add_filter('get_next_post_where',  'filter_next_post_where');

add_filter('get_previous_post_sort',  'filter_previous_post_sort');
add_filter('get_previous_post_where', 'filter_previous_post_where');

Now if you call next_post_link or previous_post_link it will display the previous/next post with the title not created date .

Some times we have a theme with page builder so we can’t use these function in the content area so i have created a short code to get the post navigation in page builder.

function next_shortcode($atts) {
    global $post;
    ob_start(); 
    next_post_link( '<div class="nav-next">%link</div>', 'Next Post<span class="arrow_carrot-right_alt2"></span>' );              
    $result = ob_get_contents();
    ob_end_clean();
    $result = (!$result ? '<div class="nav-next">&nbsp;</div>' : $result);
    return $result;
}

function prev_shortcode($atts) {
    global $post;
    ob_start();
    previous_post_link( '<div class="nav-previous">%link</div>', '<span class="arrow_carrot-left_alt2"></span> Previous Post' );              
    $result = ob_get_contents();
    ob_end_clean();
    $result = (!$result ? '<div class="nav-previous">&nbsp;</div>' : $result);
    return $result;
}
add_shortcode( 'prev_post', 'prev_shortcode' );
add_shortcode( 'next_post', 'next_shortcode' );

Now you can use short code [next_post] or [prev_post] in page content area.

http://codingbin.com/wp-content/uploads/2015/11/wordpress_logo1-1.pnghttp://codingbin.com/wp-content/uploads/2015/11/wordpress_logo1-1-150x150.pngdevidcmsWordPresspagination,wordpressIn WordPress if you want to display the previous or next post link then there is a inbuilt functions for this next_post_link() and previous_post_link(). But these function displays the date with created date . Sometimes we need to display the post with title or may be...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request