@@ 1103-1123 (lines=21) @@ | ||
1100 | */ |
|
1101 | protected function _generate_related_post_context( $post_id ) { |
|
1102 | $categories = get_the_category( $post_id ); |
|
1103 | if ( is_array( $categories ) ) { |
|
1104 | foreach ( $categories as $category ) { |
|
1105 | if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
|
1106 | $post_cat_context = sprintf( |
|
1107 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1108 | $category->name |
|
1109 | ); |
|
1110 | /** |
|
1111 | * Filter the "In Category" line displayed in the post context below each Related Post. |
|
1112 | * |
|
1113 | * @module related-posts |
|
1114 | * |
|
1115 | * @since 3.2.0 |
|
1116 | * |
|
1117 | * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
|
1118 | * @param array $category Array containing information about the category. |
|
1119 | */ |
|
1120 | return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
|
1121 | } |
|
1122 | } |
|
1123 | } |
|
1124 | ||
1125 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1126 | if ( is_array( $tags ) ) { |
|
@@ 1126-1146 (lines=21) @@ | ||
1123 | } |
|
1124 | ||
1125 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1126 | if ( is_array( $tags ) ) { |
|
1127 | foreach ( $tags as $tag ) { |
|
1128 | if ( '' != trim( $tag->name ) ) { |
|
1129 | $post_tag_context = sprintf( |
|
1130 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1131 | $tag->name |
|
1132 | ); |
|
1133 | /** |
|
1134 | * Filter the "In Tag" line displayed in the post context below each Related Post. |
|
1135 | * |
|
1136 | * @module related-posts |
|
1137 | * |
|
1138 | * @since 3.2.0 |
|
1139 | * |
|
1140 | * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
|
1141 | * @param array $tag Array containing information about the tag. |
|
1142 | */ |
|
1143 | return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
|
1144 | } |
|
1145 | } |
|
1146 | } |
|
1147 | ||
1148 | $comment_count = get_comments_number( $post_id ); |
|
1149 | if ( $comment_count > 0 ) { |