@@ 1342-1362 (lines=21) @@ | ||
1339 | */ |
|
1340 | protected function _generate_related_post_context( $post_id ) { |
|
1341 | $categories = get_the_category( $post_id ); |
|
1342 | if ( is_array( $categories ) ) { |
|
1343 | foreach ( $categories as $category ) { |
|
1344 | if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
|
1345 | $post_cat_context = sprintf( |
|
1346 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1347 | $category->name |
|
1348 | ); |
|
1349 | /** |
|
1350 | * Filter the "In Category" line displayed in the post context below each Related Post. |
|
1351 | * |
|
1352 | * @module related-posts |
|
1353 | * |
|
1354 | * @since 3.2.0 |
|
1355 | * |
|
1356 | * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
|
1357 | * @param array $category Array containing information about the category. |
|
1358 | */ |
|
1359 | return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
|
1360 | } |
|
1361 | } |
|
1362 | } |
|
1363 | ||
1364 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1365 | if ( is_array( $tags ) ) { |
|
@@ 1365-1385 (lines=21) @@ | ||
1362 | } |
|
1363 | ||
1364 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1365 | if ( is_array( $tags ) ) { |
|
1366 | foreach ( $tags as $tag ) { |
|
1367 | if ( '' != trim( $tag->name ) ) { |
|
1368 | $post_tag_context = sprintf( |
|
1369 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1370 | $tag->name |
|
1371 | ); |
|
1372 | /** |
|
1373 | * Filter the "In Tag" line displayed in the post context below each Related Post. |
|
1374 | * |
|
1375 | * @module related-posts |
|
1376 | * |
|
1377 | * @since 3.2.0 |
|
1378 | * |
|
1379 | * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
|
1380 | * @param array $tag Array containing information about the tag. |
|
1381 | */ |
|
1382 | return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
|
1383 | } |
|
1384 | } |
|
1385 | } |
|
1386 | ||
1387 | $comment_count = get_comments_number( $post_id ); |
|
1388 | if ( $comment_count > 0 ) { |