|
@@ 194-218 (lines=25) @@
|
| 191 |
|
* |
| 192 |
|
* @return string HTML for recipe notes shortcode. |
| 193 |
|
*/ |
| 194 |
|
static function recipe_notes_shortcode( $atts, $content = '' ) { |
| 195 |
|
$atts = shortcode_atts( array( |
| 196 |
|
'title' => '', //string |
| 197 |
|
), $atts, 'recipe-notes' ); |
| 198 |
|
|
| 199 |
|
$html =''; |
| 200 |
|
|
| 201 |
|
// Print a title if one exists. |
| 202 |
|
if ( '' !== $atts['title'] ) { |
| 203 |
|
$html .= '<h4 class="jetpack-recipe-notes-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
$html .= '<div class="jetpack-recipe-notes">'; |
| 207 |
|
|
| 208 |
|
// Format content using list functionality, if desired. |
| 209 |
|
$html .= self::output_list_content( $content, 'notes' ); |
| 210 |
|
|
| 211 |
|
$html .= '</div>'; |
| 212 |
|
|
| 213 |
|
// Sanitize html. |
| 214 |
|
$html = wp_kses_post( $html ); |
| 215 |
|
|
| 216 |
|
// Return the HTML block. |
| 217 |
|
return $html; |
| 218 |
|
} |
| 219 |
|
|
| 220 |
|
/** |
| 221 |
|
* Our [recipe-ingredients] shortcode. |
|
@@ 226-248 (lines=23) @@
|
| 223 |
|
* |
| 224 |
|
* @return string HTML for recipe ingredients shortcode. |
| 225 |
|
*/ |
| 226 |
|
static function recipe_ingredients_shortcode( $atts, $content = '' ) { |
| 227 |
|
$atts = shortcode_atts( array( |
| 228 |
|
'title' => esc_html_x( 'Ingredients', 'recipe', 'jetpack' ), //string |
| 229 |
|
), $atts, 'recipe-ingredients' ); |
| 230 |
|
|
| 231 |
|
$html = '<div class="jetpack-recipe-ingredients">'; |
| 232 |
|
|
| 233 |
|
// Print a title unless the user has opted to exclude it. |
| 234 |
|
if ( 'false' !== $atts['title'] ) { |
| 235 |
|
$html .= '<h4 class="jetpack-recipe-ingredients-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
// Format content using list functionality. |
| 239 |
|
$html .= self::output_list_content( $content, 'ingredients' ); |
| 240 |
|
|
| 241 |
|
$html .= '</div>'; |
| 242 |
|
|
| 243 |
|
// Sanitize html. |
| 244 |
|
$html = wp_kses_post( $html ); |
| 245 |
|
|
| 246 |
|
// Return the HTML block. |
| 247 |
|
return $html; |
| 248 |
|
} |
| 249 |
|
|
| 250 |
|
/** |
| 251 |
|
* Reusable function to check for shortened formatting. |
|
@@ 335-357 (lines=23) @@
|
| 332 |
|
* |
| 333 |
|
* @return string HTML for recipe notes shortcode. |
| 334 |
|
*/ |
| 335 |
|
static function recipe_directions_shortcode( $atts, $content = '' ) { |
| 336 |
|
$atts = shortcode_atts( array( |
| 337 |
|
'title' => esc_html_x( 'Directions', 'recipe', 'jetpack' ), //string |
| 338 |
|
), $atts, 'recipe-directions' ); |
| 339 |
|
|
| 340 |
|
$html = '<div class="jetpack-recipe-directions">'; |
| 341 |
|
|
| 342 |
|
// Print a title unless the user has specified to exclude it. |
| 343 |
|
if ( 'false' !== $atts['title'] ) { |
| 344 |
|
$html .= '<h4 class="jetpack-recipe-directions-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
// Format content using list functionality. |
| 348 |
|
$html .= self::output_list_content( $content, 'directions' ); |
| 349 |
|
|
| 350 |
|
$html .= '</div>'; |
| 351 |
|
|
| 352 |
|
// Sanitize html. |
| 353 |
|
$html = wp_kses_post( $html ); |
| 354 |
|
|
| 355 |
|
// Return the HTML block. |
| 356 |
|
return $html; |
| 357 |
|
} |
| 358 |
|
|
| 359 |
|
/** |
| 360 |
|
* Use $themecolors array to style the Recipes shortcode |