@@ 1190-1206 (lines=17) @@ | ||
1187 | * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post. |
|
1188 | * @return bool True if the comments are open. |
|
1189 | */ |
|
1190 | function comments_open( $post_id = null ) { |
|
1191 | ||
1192 | $_post = get_post($post_id); |
|
1193 | ||
1194 | $post_id = $_post ? $_post->ID : 0; |
|
1195 | $open = ( 'open' == $_post->comment_status ); |
|
1196 | ||
1197 | /** |
|
1198 | * Filters whether the current post is open for comments. |
|
1199 | * |
|
1200 | * @since 2.5.0 |
|
1201 | * |
|
1202 | * @param bool $open Whether the current post is open for comments. |
|
1203 | * @param int $post_id The post ID. |
|
1204 | */ |
|
1205 | return apply_filters( 'comments_open', $open, $post_id ); |
|
1206 | } |
|
1207 | ||
1208 | /** |
|
1209 | * Whether the current post is open for pings. |
|
@@ 1216-1232 (lines=17) @@ | ||
1213 | * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post. |
|
1214 | * @return bool True if pings are accepted |
|
1215 | */ |
|
1216 | function pings_open( $post_id = null ) { |
|
1217 | ||
1218 | $_post = get_post($post_id); |
|
1219 | ||
1220 | $post_id = $_post ? $_post->ID : 0; |
|
1221 | $open = ( 'open' == $_post->ping_status ); |
|
1222 | ||
1223 | /** |
|
1224 | * Filters whether the current post is open for pings. |
|
1225 | * |
|
1226 | * @since 2.5.0 |
|
1227 | * |
|
1228 | * @param bool $open Whether the current post is open for pings. |
|
1229 | * @param int $post_id The post ID. |
|
1230 | */ |
|
1231 | return apply_filters( 'pings_open', $open, $post_id ); |
|
1232 | } |
|
1233 | ||
1234 | /** |
|
1235 | * Display form token for unfiltered comments. |