Last active
November 4, 2015 12:52
-
-
Save badah/ac6b0cfe6636f80973ba to your computer and use it in GitHub Desktop.
Wordpress: Change query properties
This file contains hidden or 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
/* | |
Change query properties | |
*/ | |
function badah_change_query( $query ) { | |
if ( !is_admin() && $query->is_main_query() ) { | |
if ( $query->is_front_page() ) { | |
$query->set( 'showposts', 1 ); // whatever | |
} | |
} | |
} | |
add_action( 'pre_get_posts', 'badah_change_query' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment