|
@@ 1265-1285 (lines=21) @@
|
| 1262 |
|
*/ |
| 1263 |
|
protected function _generate_related_post_context( $post_id ) { |
| 1264 |
|
$categories = get_the_category( $post_id ); |
| 1265 |
|
if ( is_array( $categories ) ) { |
| 1266 |
|
foreach ( $categories as $category ) { |
| 1267 |
|
if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) { |
| 1268 |
|
$post_cat_context = sprintf( |
| 1269 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1270 |
|
$category->name |
| 1271 |
|
); |
| 1272 |
|
/** |
| 1273 |
|
* Filter the "In Category" line displayed in the post context below each Related Post. |
| 1274 |
|
* |
| 1275 |
|
* @module related-posts |
| 1276 |
|
* |
| 1277 |
|
* @since 3.2.0 |
| 1278 |
|
* |
| 1279 |
|
* @param string $post_cat_context "In Category" line displayed in the post context below each Related Post. |
| 1280 |
|
* @param array $category Array containing information about the category. |
| 1281 |
|
*/ |
| 1282 |
|
return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category ); |
| 1283 |
|
} |
| 1284 |
|
} |
| 1285 |
|
} |
| 1286 |
|
|
| 1287 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1288 |
|
if ( is_array( $tags ) ) { |
|
@@ 1288-1308 (lines=21) @@
|
| 1285 |
|
} |
| 1286 |
|
|
| 1287 |
|
$tags = get_the_terms( $post_id, 'post_tag' ); |
| 1288 |
|
if ( is_array( $tags ) ) { |
| 1289 |
|
foreach ( $tags as $tag ) { |
| 1290 |
|
if ( '' != trim( $tag->name ) ) { |
| 1291 |
|
$post_tag_context = sprintf( |
| 1292 |
|
_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ), |
| 1293 |
|
$tag->name |
| 1294 |
|
); |
| 1295 |
|
/** |
| 1296 |
|
* Filter the "In Tag" line displayed in the post context below each Related Post. |
| 1297 |
|
* |
| 1298 |
|
* @module related-posts |
| 1299 |
|
* |
| 1300 |
|
* @since 3.2.0 |
| 1301 |
|
* |
| 1302 |
|
* @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post. |
| 1303 |
|
* @param array $tag Array containing information about the tag. |
| 1304 |
|
*/ |
| 1305 |
|
return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag ); |
| 1306 |
|
} |
| 1307 |
|
} |
| 1308 |
|
} |
| 1309 |
|
|
| 1310 |
|
$comment_count = get_comments_number( $post_id ); |
| 1311 |
|
if ( $comment_count > 0 ) { |