|
@@ 1481-1501 (lines=21) @@
|
| 1478 |
|
*/ |
| 1479 |
|
protected function _generate_related_post_context( $post_id ) { |
| 1480 |
|
$categories = get_the_category( $post_id ); |
| 1481 |
|
if ( is_array( $categories ) ) { |
| 1482 |
|
foreach ( $categories as $category ) { |
| 1483 |
|
if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
| 1484 |
|
$post_cat_context = sprintf( |
| 1485 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1486 |
|
$category->name |
| 1487 |
|
); |
| 1488 |
|
/** |
| 1489 |
|
* Filter the "In Category" 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_cat_context "In Category" line displayed in the post context below each Related Post. |
| 1496 |
|
* @param array $category Array containing information about the category. |
| 1497 |
|
*/ |
| 1498 |
|
return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
| 1499 |
|
} |
| 1500 |
|
} |
| 1501 |
|
} |
| 1502 |
|
|
| 1503 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1504 |
|
if ( is_array( $tags ) ) { |
|
@@ 1504-1524 (lines=21) @@
|
| 1501 |
|
} |
| 1502 |
|
|
| 1503 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1504 |
|
if ( is_array( $tags ) ) { |
| 1505 |
|
foreach ( $tags as $tag ) { |
| 1506 |
|
if ( '' != trim( $tag->name ) ) { |
| 1507 |
|
$post_tag_context = sprintf( |
| 1508 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1509 |
|
$tag->name |
| 1510 |
|
); |
| 1511 |
|
/** |
| 1512 |
|
* Filter the "In Tag" line displayed in the post context below each Related Post. |
| 1513 |
|
* |
| 1514 |
|
* @module related-posts |
| 1515 |
|
* |
| 1516 |
|
* @since 3.2.0 |
| 1517 |
|
* |
| 1518 |
|
* @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
| 1519 |
|
* @param array $tag Array containing information about the tag. |
| 1520 |
|
*/ |
| 1521 |
|
return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
| 1522 |
|
} |
| 1523 |
|
} |
| 1524 |
|
} |
| 1525 |
|
|
| 1526 |
|
$comment_count = get_comments_number( $post_id ); |
| 1527 |
|
if ( $comment_count > 0 ) { |