1229 | 1229 | * |
1230 | 1230 | * For more information on this and similar theme functions, check out |
1231 | 1231 | * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
1232 | 1232 | * Conditional Tags} article in the Theme Developer Handbook. |
1233 | 1233 | * |
1234 | 1234 | * @since 1.5.0 |
1235 | 1235 | * |
1236 | 1236 | * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post. |
1237 | 1237 | * @return bool True if the comments are open. |
1238 | 1238 | */ |
1239 | 1239 | function comments_open( $post_id = null ) { |
1240 | 1240 | |
1241 | 1241 | $_post = get_post( $post_id ); |
1242 | 1242 | |
1243 | 1243 | $post_id = $_post ? $_post->ID : 0; |
1245 | 1245 | |
1246 | 1246 | /** |
1247 | 1247 | * Filters whether the current post is open for comments. |
1248 | 1248 | * |
1249 | 1249 | * @since 2.5.0 |
1250 | 1250 | * |
1251 | 1251 | * @param bool $open Whether the current post is open for comments. |
1252 | 1252 | * @param int $post_id The post ID. |
1253 | 1253 | */ |
1254 | 1254 | return apply_filters( 'comments_open', $open, $post_id ); |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
1258 | 1258 | * Determines whether the current post is open for pings. |
1259 | 1259 | * |
1260 | 1260 | * For more information on this and similar theme functions, check out |
1261 | 1261 | * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
1262 | 1262 | * Conditional Tags} article in the Theme Developer Handbook. |
1263 | 1263 | * |
1264 | 1264 | * @since 1.5.0 |
1265 | 1265 | * |
1266 | 1266 | * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post. |
1267 | 1267 | * @return bool True if pings are accepted |
1268 | 1268 | */ |
1269 | 1269 | function pings_open( $post_id = null ) { |
1270 | 1270 | |
1271 | 1271 | $_post = get_post( $post_id ); |
1272 | 1272 | |
1273 | 1273 | $post_id = $_post ? $_post->ID : 0; |