← All changes
|
modules/theme-tools/content-options/blog-display.php
+22
-2
13.8.3
→
16.3-a.5
View file →
| @@ -4,8 +4,12 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + exit( 0 ); | |
| 10 | +} | |
| 11 | + | |
| 8 | 12 | /** |
| 9 | 13 | * If the theme doesn't support 'jetpack-content-options', don't continue. |
| 10 | 14 | */ |
| 11 | 15 | if ( ! current_theme_supports( 'jetpack-content-options' ) ) { |
| @@ -34,13 +38,15 @@ | ||
| 34 | 38 | |
| 35 | 39 | /** |
| 36 | 40 | * Apply Content filters. |
| 37 | 41 | * |
| 42 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 38 | 43 | * @since 9.7.0 Deprecated $content parameter. |
| 39 | 44 | * |
| 40 | 45 | * @param string $content Post content. Deprecated. |
| 41 | 46 | */ |
| 42 | 47 | function jetpack_blog_display_custom_excerpt( $content = '' ) { |
| 48 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 43 | 49 | if ( ! empty( $content ) ) { |
| 44 | 50 | _doing_it_wrong( |
| 45 | 51 | 'jetpack_blog_display_custom_excerpt', |
| 46 | 52 | esc_html__( 'You do not need to pass a $content parameter anymore.', 'jetpack' ), |
| @@ -78,10 +84,10 @@ | ||
| 78 | 84 | } |
| 79 | 85 | |
| 80 | 86 | if ( count( $words ) > $excerpt_length ) { |
| 81 | 87 | array_pop( $words ); |
| 82 | - $text = implode( $sep, $words ); | |
| 83 | - $text = $text . $excerpt_more; | |
| 88 | + $text = implode( $sep, $words ); | |
| 89 | + $text .= $excerpt_more; | |
| 84 | 90 | } else { |
| 85 | 91 | $text = implode( $sep, $words ); |
| 86 | 92 | } |
| 87 | 93 | } else { |
| @@ -96,11 +102,14 @@ | ||
| 96 | 102 | |
| 97 | 103 | /** |
| 98 | 104 | * Display Excerpt instead of Content. |
| 99 | 105 | * |
| 106 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 107 | + * | |
| 100 | 108 | * @param string $content Post content. |
| 101 | 109 | */ |
| 102 | 110 | function jetpack_the_content_to_the_excerpt( $content ) { |
| 111 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 103 | 112 | if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { |
| 104 | 113 | if ( post_password_required() ) { |
| 105 | 114 | $excerpt = sprintf( '<p>%s</p>', esc_html__( 'There is no excerpt because this is a protected post.', 'jetpack' ) ); |
| 106 | 115 | } else { |
| @@ -120,11 +129,14 @@ | ||
| 120 | 129 | |
| 121 | 130 | /** |
| 122 | 131 | * Display Content instead of Excerpt. |
| 123 | 132 | * |
| 133 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 134 | + * | |
| 124 | 135 | * @param string $content The post excerpt. |
| 125 | 136 | */ |
| 126 | 137 | function jetpack_the_excerpt_to_the_content( $content ) { |
| 138 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 127 | 139 | if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { |
| 128 | 140 | ob_start(); |
| 129 | 141 | the_content( |
| 130 | 142 | sprintf( |
| @@ -151,11 +163,13 @@ | ||
| 151 | 163 | |
| 152 | 164 | /** |
| 153 | 165 | * Display both Content and Excerpt instead of Content in the Customizer so live preview can switch between them. |
| 154 | 166 | * |
| 167 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 155 | 168 | * @param string $content The post content. |
| 156 | 169 | */ |
| 157 | 170 | function jetpack_the_content_customizer( $content ) { |
| 171 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 158 | 172 | $class = jetpack_the_content_customizer_class(); |
| 159 | 173 | if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { |
| 160 | 174 | if ( post_password_required() ) { |
| 161 | 175 | $excerpt = sprintf( '<p>%s</p>', esc_html__( 'There is no excerpt because this is a protected post.', 'jetpack' ) ); |
| @@ -176,11 +190,13 @@ | ||
| 176 | 190 | |
| 177 | 191 | /** |
| 178 | 192 | * Display both Content and Excerpt instead of Excerpt in the Customizer so live preview can switch between them. |
| 179 | 193 | * |
| 194 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 180 | 195 | * @param string $excerpt The post excerpt. |
| 181 | 196 | */ |
| 182 | 197 | function jetpack_the_excerpt_customizer( $excerpt ) { |
| 198 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 183 | 199 | if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { |
| 184 | 200 | ob_start(); |
| 185 | 201 | the_content( |
| 186 | 202 | sprintf( |
| @@ -211,11 +227,13 @@ | ||
| 211 | 227 | |
| 212 | 228 | /** |
| 213 | 229 | * Display Content instead of Excerpt in the Customizer when theme uses a 'Mixed' display. |
| 214 | 230 | * |
| 231 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 215 | 232 | * @param string $content The post excerpt. |
| 216 | 233 | */ |
| 217 | 234 | function jetpack_the_excerpt_mixed_customizer( $content ) { |
| 235 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 218 | 236 | if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { |
| 219 | 237 | jetpack_the_content_customizer_class( 'output-the-excerpt' ); |
| 220 | 238 | ob_start(); |
| 221 | 239 | the_content(); |
| @@ -231,11 +249,13 @@ | ||
| 231 | 249 | /** |
| 232 | 250 | * Returns a class value, `output-the-content` by default. |
| 233 | 251 | * Used for themes with a 'Mixed' Blog Display so we can tell which output is by default. |
| 234 | 252 | * |
| 253 | + * @deprecated 13.9 Moved to Classic Theme Helper package. | |
| 235 | 254 | * @param string|null $new_class CSS class added to content container. |
| 236 | 255 | */ |
| 237 | 256 | function jetpack_the_content_customizer_class( $new_class = null ) { |
| 257 | + _deprecated_function( __FUNCTION__, 'jetpack-13.9' ); | |
| 238 | 258 | static $class; |
| 239 | 259 | if ( isset( $new_class ) ) { |
| 240 | 260 | // Assign a new class and return. |
| 241 | 261 | $class = $new_class; |