-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunmus_feed.php
55 lines (43 loc) · 1.16 KB
/
unmus_feed.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
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Feed
*
* @package unmus
* @since 0.1
*/
/**
* Add Custom Post Types to Main Feed
*
* @param array Query Vars
*/
function unmus_add_custom_post_types_to_feed($qv) {
if (isset($qv['feed']) && !isset($qv['post_type'])) {
$qv['post_type'] = array('post','ello','pinseldisko','podcast');
}
return $qv;
}
add_filter('request', 'unmus_add_custom_post_types_to_feed');
/**
* Remove Post Formats Quote & Image from Feed
*
* @param WP_Query The WP_Query Instance
*/
function unmus_filter_post_formats_from_feed(&$wp_query) {
if( $wp_query->is_feed ) {
$post_format_tax_query = array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-quote','post-format-image'),
'operator' => 'NOT IN'
);
$tax_query = $wp_query->get( 'tax_query' );
if ( is_array( $tax_query ) ) {
$tax_query = $tax_query + $post_format_tax_query;
} else {
$tax_query = array( $post_format_tax_query );
}
$wp_query->set( 'tax_query', $tax_query );
}
}
add_filter('pre_get_posts','unmus_filter_post_formats_from_feed');
?>