3
3
Plugin Name: JSON Feed
4
4
Plugin URI: https://github.com/manton/jsonfeed-wp/
5
5
Description: Adds a feed of recent posts in JSON Feed format.
6
- Version: 1.4.4
6
+ Version: 1.4.5
7
7
Author: Manton Reece and Daniel Jalkut
8
8
Text Domain: jsonfeed
9
9
License: GPL2.0+
@@ -28,10 +28,10 @@ function do_feed_json( $for_comments ) {
28
28
header ( 'Access-Control-Allow-Origin: * ' );
29
29
30
30
if ( $ for_comments ) {
31
- load_template ( dirname ( __FILE__ ) . '/feed-json-comments.php ' );
31
+ load_template ( __DIR__ . '/feed-json-comments.php ' );
32
32
} else {
33
33
34
- load_template ( dirname ( __FILE__ ) . '/feed-json.php ' );
34
+ load_template ( __DIR__ . '/feed-json.php ' );
35
35
}
36
36
}
37
37
@@ -43,6 +43,14 @@ function json_feed_content_type( $content_type, $type ) {
43
43
return $ content_type ;
44
44
}
45
45
46
+
47
+ function json_feed_w3tc_is_cacheable_content_type ( $ types ) {
48
+ $ types [] = 'application/feed+json ' ;
49
+ return array_unique ( $ types );
50
+ }
51
+
52
+ add_filter ( 'w3tc_is_cacheable_content_type ' , 'json_feed_w3tc_is_cacheable_content_type ' );
53
+
46
54
add_action ( 'wp_head ' , 'json_feed_link ' );
47
55
function json_feed_link () {
48
56
printf (
@@ -79,9 +87,10 @@ function json_feed_links_extra( $args = array() ) {
79
87
);
80
88
$ args = wp_parse_args ( $ args , $ defaults );
81
89
if ( is_singular () ) {
82
- $ id = 0 ;
83
- $ post = get_post ( $ id );
84
- if ( comments_open () || pings_open () || $ post ->comment_count > 0 ) {
90
+ $ id = 0 ;
91
+ $ post = get_post ( $ id );
92
+ $ comments = apply_filters ( 'jsonfeed_comments_feed_enable ' , true );
93
+ if ( $ comments && ( comments_open () || pings_open () || $ post ->comment_count > 0 ) ) {
85
94
$ title = sprintf ( $ args ['singletitle ' ], get_bloginfo ( 'name ' ), $ args ['separator ' ], the_title_attribute ( array ( 'echo ' => false ) ) );
86
95
$ href = get_post_comments_feed_link ( $ post ->ID , 'json ' );
87
96
}
@@ -145,4 +154,4 @@ function json_feed_websub( $feed_types ) {
145
154
}
146
155
add_filter ( 'pubsubhubbub_supported_feed_types ' , 'json_feed_websub ' );
147
156
148
- require_once dirname ( __FILE__ ) . '/feed-json-functions.php ' ;
157
+ require_once __DIR__ . '/feed-json-functions.php ' ;
0 commit comments