Add function to filter posts on start page by category
This commit is contained in:
parent
bf7be82f70
commit
c9b9542137
1 changed files with 8 additions and 0 deletions
|
|
@ -20,6 +20,14 @@ function my_acf_google_map_api( $api ){
|
|||
|
||||
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
|
||||
|
||||
// Only show posts of category Urlaub (id=2)
|
||||
function my_home_category( $query ) {
|
||||
if ( $query->is_home() && $query->is_main_query() ) {
|
||||
$query->set( 'cat', '2');
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'pre_get_posts', 'my_home_category' );
|
||||
|
||||
// Related posts function
|
||||
function atravelblog_related_posts() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue