@@ 1133-1153 (lines=21) @@ | ||
1130 | */ |
|
1131 | protected function _generate_related_post_context( $post_id ) { |
|
1132 | $categories = get_the_category( $post_id ); |
|
1133 | if ( is_array( $categories ) ) { |
|
1134 | foreach ( $categories as $category ) { |
|
1135 | if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
|
1136 | $post_cat_context = sprintf( |
|
1137 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1138 | $category->name |
|
1139 | ); |
|
1140 | /** |
|
1141 | * Filter the "In Category" line displayed in the post context below each Related Post. |
|
1142 | * |
|
1143 | * @module related-posts |
|
1144 | * |
|
1145 | * @since 3.2.0 |
|
1146 | * |
|
1147 | * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
|
1148 | * @param array $category Array containing information about the category. |
|
1149 | */ |
|
1150 | return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
|
1151 | } |
|
1152 | } |
|
1153 | } |
|
1154 | ||
1155 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1156 | if ( is_array( $tags ) ) { |
|
@@ 1156-1176 (lines=21) @@ | ||
1153 | } |
|
1154 | ||
1155 | $tags = get_the_terms( $post_id, 'post_tag' ); |
|
1156 | if ( is_array( $tags ) ) { |
|
1157 | foreach ( $tags as $tag ) { |
|
1158 | if ( '' != trim( $tag->name ) ) { |
|
1159 | $post_tag_context = sprintf( |
|
1160 | _x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
|
1161 | $tag->name |
|
1162 | ); |
|
1163 | /** |
|
1164 | * Filter the "In Tag" line displayed in the post context below each Related Post. |
|
1165 | * |
|
1166 | * @module related-posts |
|
1167 | * |
|
1168 | * @since 3.2.0 |
|
1169 | * |
|
1170 | * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
|
1171 | * @param array $tag Array containing information about the tag. |
|
1172 | */ |
|
1173 | return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
|
1174 | } |
|
1175 | } |
|
1176 | } |
|
1177 | ||
1178 | $comment_count = get_comments_number( $post_id ); |
|
1179 | if ( $comment_count > 0 ) { |