I've got this code below in my functions.php and I'd like to add two filters with conditional statement not to effect every query_posts. Something like this
if(!is_admin() && is_page('Home')){ //two filters }
However, I don't know PHP well enough to know where to put it or how to use the <?php> tags.
Can anyone advise? It is from this thread that was closed in WP Forums.
add_filter('posts_orderby', 'edit_posts_orderby');
add_filter('posts_join_paged','edit_posts_join_paged');
function edit_posts_join_paged($join_paged_statement) {
global $wpdb;
$join_paged_statement = "LEFT JOIN ".$wpdb->prefix."wpv_voting ON ".$wpdb->prefix."wpv_voting.post_id = $wpdb->posts.ID";
return $join_paged_statement;
}
function edit_posts_orderby($orderby_statement) {
global $wpdb;
$orderby_statement = "(".$wpdb->prefix."wpv_voting.vote_count) DESC";
return $orderby_statement;
}