Set number of posts via function instead of index
This commit is contained in:
parent
64f6ed823d
commit
6647435c11
2 changed files with 4 additions and 47 deletions
|
|
@ -23,7 +23,9 @@ 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');
|
||||
$query->set( 'cat', '2');
|
||||
// set number of posts to 9
|
||||
$query->set( 'posts_per_page', '9');
|
||||
if ( !empty( $_GET['person'] ) ) {
|
||||
$query->set( 'meta_query', array(
|
||||
array(
|
||||
|
|
@ -82,4 +84,4 @@ function atravelblog_related_posts() {
|
|||
add_post_image_thumbs($urlaub, 'Urlaub:');
|
||||
wp_reset_query();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue