-
-
Save cre8tivediva/b6a7714f294c12c8b92cc9ca9943d74a to your computer and use it in GitHub Desktop.
Display one category home page
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
// Only One Category on home page - change cat id for your category | |
function only_one_category( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) { | |
$query->set( 'cat', '5' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'only_one_category' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment