Created
March 16, 2014 05:36
-
-
Save nicholasohrn/9578989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function force_orderby_post_name($wp_query) { | |
$wp_query->query_vars['orderby'] = 'post_name'; | |
$wp_query->query_vars['order'] = 'ASC'; | |
} | |
function previous_image_link_by_slug($size = 'thumbnail', $text = false) { | |
add_filter('pre_get_posts', 'force_orderby_post_name', 11); | |
previous_image_link($size, $text); | |
remove_filter('pre_get_posts', 'force_orderby_post_name', 11); | |
} | |
function next_image_link_by_slug($size = 'thumbnail', $text = false) { | |
add_filter('pre_get_posts', 'force_orderby_post_name', 11); | |
next_image_link($size, $text); | |
remove_filter('pre_get_posts', 'force_orderby_post_name', 11); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment