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