|
@@ 1458-1478 (lines=21) @@
|
| 1455 |
|
*/ |
| 1456 |
|
protected function _generate_related_post_context( $post_id ) { |
| 1457 |
|
$categories = get_the_category( $post_id ); |
| 1458 |
|
if ( is_array( $categories ) ) { |
| 1459 |
|
foreach ( $categories as $category ) { |
| 1460 |
|
if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
| 1461 |
|
$post_cat_context = sprintf( |
| 1462 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1463 |
|
$category->name |
| 1464 |
|
); |
| 1465 |
|
/** |
| 1466 |
|
* Filter the "In Category" line displayed in the post context below each Related Post. |
| 1467 |
|
* |
| 1468 |
|
* @module related-posts |
| 1469 |
|
* |
| 1470 |
|
* @since 3.2.0 |
| 1471 |
|
* |
| 1472 |
|
* @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
| 1473 |
|
* @param array $category Array containing information about the category. |
| 1474 |
|
*/ |
| 1475 |
|
return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
| 1476 |
|
} |
| 1477 |
|
} |
| 1478 |
|
} |
| 1479 |
|
|
| 1480 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1481 |
|
if ( is_array( $tags ) ) { |
|
@@ 1481-1501 (lines=21) @@
|
| 1478 |
|
} |
| 1479 |
|
|
| 1480 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1481 |
|
if ( is_array( $tags ) ) { |
| 1482 |
|
foreach ( $tags as $tag ) { |
| 1483 |
|
if ( '' != trim( $tag->name ) ) { |
| 1484 |
|
$post_tag_context = sprintf( |
| 1485 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1486 |
|
$tag->name |
| 1487 |
|
); |
| 1488 |
|
/** |
| 1489 |
|
* Filter the "In Tag" line displayed in the post context below each Related Post. |
| 1490 |
|
* |
| 1491 |
|
* @module related-posts |
| 1492 |
|
* |
| 1493 |
|
* @since 3.2.0 |
| 1494 |
|
* |
| 1495 |
|
* @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
| 1496 |
|
* @param array $tag Array containing information about the tag. |
| 1497 |
|
*/ |
| 1498 |
|
return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
| 1499 |
|
} |
| 1500 |
|
} |
| 1501 |
|
} |
| 1502 |
|
|
| 1503 |
|
$comment_count = get_comments_number( $post_id ); |
| 1504 |
|
if ( $comment_count > 0 ) { |