|
@@ 1539-1559 (lines=21) @@
|
| 1536 |
|
*/ |
| 1537 |
|
protected function _generate_related_post_context( $post_id ) { |
| 1538 |
|
$categories = get_the_category( $post_id ); |
| 1539 |
|
if ( is_array( $categories ) ) { |
| 1540 |
|
foreach ( $categories as $category ) { |
| 1541 |
|
if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
| 1542 |
|
$post_cat_context = sprintf( |
| 1543 |
|
esc_html_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1544 |
|
$category->name |
| 1545 |
|
); |
| 1546 |
|
/** |
| 1547 |
|
* Filter the "In Category" line displayed in the post context below each Related Post. |
| 1548 |
|
* |
| 1549 |
|
* @module related-posts |
| 1550 |
|
* |
| 1551 |
|
* @since 3.2.0 |
| 1552 |
|
* |
| 1553 |
|
* @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
| 1554 |
|
* @param array $category Array containing information about the category. |
| 1555 |
|
*/ |
| 1556 |
|
return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
| 1557 |
|
} |
| 1558 |
|
} |
| 1559 |
|
} |
| 1560 |
|
|
| 1561 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1562 |
|
if ( is_array( $tags ) ) { |
|
@@ 1562-1582 (lines=21) @@
|
| 1559 |
|
} |
| 1560 |
|
|
| 1561 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1562 |
|
if ( is_array( $tags ) ) { |
| 1563 |
|
foreach ( $tags as $tag ) { |
| 1564 |
|
if ( '' != trim( $tag->name ) ) { |
| 1565 |
|
$post_tag_context = sprintf( |
| 1566 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1567 |
|
$tag->name |
| 1568 |
|
); |
| 1569 |
|
/** |
| 1570 |
|
* Filter the "In Tag" line displayed in the post context below each Related Post. |
| 1571 |
|
* |
| 1572 |
|
* @module related-posts |
| 1573 |
|
* |
| 1574 |
|
* @since 3.2.0 |
| 1575 |
|
* |
| 1576 |
|
* @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
| 1577 |
|
* @param array $tag Array containing information about the tag. |
| 1578 |
|
*/ |
| 1579 |
|
return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
| 1580 |
|
} |
| 1581 |
|
} |
| 1582 |
|
} |
| 1583 |
|
|
| 1584 |
|
$comment_count = get_comments_number( $post_id ); |
| 1585 |
|
if ( $comment_count > 0 ) { |