@@ 1569-1589 (lines=21) @@ | ||
1566 | */ |
|
1567 | protected function _generate_related_post_context( $post_id ) { |
|
1568 | $categories = get_the_category( $post_id ); |
|
1569 | if ( is_array( $categories ) ) { |
|
1570 | foreach ( $categories as $category ) { |
|
1571 | if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
|
1572 | $post_cat_context = sprintf( |
|
1573 | esc_html_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1574 | $category->name |
|
1575 | ); |
|
1576 | /** |
|
1577 | * Filter the "In Category" line displayed in the post context below each Related Post. |
|
1578 | * |
|
1579 | * @module related-posts |
|
1580 | * |
|
1581 | * @since 3.2.0 |
|
1582 | * |
|
1583 | * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
|
1584 | * @param array $category Array containing information about the category. |
|
1585 | */ |
|
1586 | return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
|
1587 | } |
|
1588 | } |
|
1589 | } |
|
1590 | ||
1591 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1592 | if ( is_array( $tags ) ) { |
|
@@ 1592-1612 (lines=21) @@ | ||
1589 | } |
|
1590 | ||
1591 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1592 | if ( is_array( $tags ) ) { |
|
1593 | foreach ( $tags as $tag ) { |
|
1594 | if ( '' != trim( $tag->name ) ) { |
|
1595 | $post_tag_context = sprintf( |
|
1596 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1597 | $tag->name |
|
1598 | ); |
|
1599 | /** |
|
1600 | * Filter the "In Tag" line displayed in the post context below each Related Post. |
|
1601 | * |
|
1602 | * @module related-posts |
|
1603 | * |
|
1604 | * @since 3.2.0 |
|
1605 | * |
|
1606 | * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
|
1607 | * @param array $tag Array containing information about the tag. |
|
1608 | */ |
|
1609 | return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
|
1610 | } |
|
1611 | } |
|
1612 | } |
|
1613 | ||
1614 | $comment_count = get_comments_number( $post_id ); |
|
1615 | if ( $comment_count > 0 ) { |