Revision: 66434
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 6, 2014 06:33 by fedek6
Initial Code
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 = '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 = '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');
Initial URL
Initial Description
Get next and prev posts in Wordpress by alphabetical order.
Initial Title
Adjacent post by alphabetical order in Wordpress
Initial Tags
Initial Language
PHP