-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunmus_loop.php
45 lines (35 loc) · 1001 Bytes
/
unmus_loop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Loop
*
* @package unmus
* @since 0.7
*/
// Security: Stops code execution if WordPress is not loaded
if (!defined('ABSPATH')) { exit; }
/**
* Modify Amount of Posts per Page for Custom Post Types
*
* @since 0.7
*
* @param WP_Query The WP_Query Instance
*/
function unmus_amount_of_posts_per_page( $query ) {
if ( is_admin() || ! $query->is_main_query() ) {
return;
}
if ( is_post_type_archive( 'raketenstaub' ) ) {
$amountofposts=get_option('unmus_raketenstaub_amountofposts');
$query->set( 'posts_per_page', $amountofposts );
}
if ( is_post_type_archive( 'ello' ) ) {
$amountofposts=get_option('unmus_ello_amountofposts');
$query->set( 'posts_per_page', $amountofposts );
}
if ( is_post_type_archive( 'podcast' ) ) {
$amountofposts=get_option('unmus_zirkusliebe_amountofposts');
$query->set( 'posts_per_page', $amountofposts );
}
}
add_filter( 'pre_get_posts', 'unmus_amount_of_posts_per_page' );
?>