|
@@ 323-347 (lines=25) @@
|
| 320 |
|
* |
| 321 |
|
* @return string HTML for recipe notes shortcode. |
| 322 |
|
*/ |
| 323 |
|
static function recipe_notes_shortcode( $atts, $content = '' ) { |
| 324 |
|
$atts = shortcode_atts( array( |
| 325 |
|
'title' => '', // string. |
| 326 |
|
), $atts, 'recipe-notes' ); |
| 327 |
|
|
| 328 |
|
$html = ''; |
| 329 |
|
|
| 330 |
|
// Print a title if one exists. |
| 331 |
|
if ( '' !== $atts['title'] ) { |
| 332 |
|
$html .= '<h4 class="jetpack-recipe-notes-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 333 |
|
} |
| 334 |
|
|
| 335 |
|
$html .= '<div class="jetpack-recipe-notes">'; |
| 336 |
|
|
| 337 |
|
// Format content using list functionality, if desired. |
| 338 |
|
$html .= self::output_list_content( $content, 'notes' ); |
| 339 |
|
|
| 340 |
|
$html .= '</div>'; |
| 341 |
|
|
| 342 |
|
// Sanitize html. |
| 343 |
|
$html = wp_kses_post( $html ); |
| 344 |
|
|
| 345 |
|
// Return the HTML block. |
| 346 |
|
return $html; |
| 347 |
|
} |
| 348 |
|
|
| 349 |
|
/** |
| 350 |
|
* Our [recipe-ingredients] shortcode. |
|
@@ 358-380 (lines=23) @@
|
| 355 |
|
* |
| 356 |
|
* @return string HTML for recipe ingredients shortcode. |
| 357 |
|
*/ |
| 358 |
|
static function recipe_ingredients_shortcode( $atts, $content = '' ) { |
| 359 |
|
$atts = shortcode_atts( array( |
| 360 |
|
'title' => esc_html_x( 'Ingredients', 'recipe', 'jetpack' ), // string. |
| 361 |
|
), $atts, 'recipe-ingredients' ); |
| 362 |
|
|
| 363 |
|
$html = '<div class="jetpack-recipe-ingredients">'; |
| 364 |
|
|
| 365 |
|
// Print a title unless the user has opted to exclude it. |
| 366 |
|
if ( 'false' !== $atts['title'] ) { |
| 367 |
|
$html .= '<h4 class="jetpack-recipe-ingredients-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 368 |
|
} |
| 369 |
|
|
| 370 |
|
// Format content using list functionality. |
| 371 |
|
$html .= self::output_list_content( $content, 'ingredients' ); |
| 372 |
|
|
| 373 |
|
$html .= '</div>'; |
| 374 |
|
|
| 375 |
|
// Sanitize html. |
| 376 |
|
$html = wp_kses_post( $html ); |
| 377 |
|
|
| 378 |
|
// Return the HTML block. |
| 379 |
|
return $html; |
| 380 |
|
} |
| 381 |
|
|
| 382 |
|
/** |
| 383 |
|
* Reusable function to check for shortened formatting. |
|
@@ 473-495 (lines=23) @@
|
| 470 |
|
* |
| 471 |
|
* @return string HTML for recipe directions shortcode. |
| 472 |
|
*/ |
| 473 |
|
static function recipe_directions_shortcode( $atts, $content = '' ) { |
| 474 |
|
$atts = shortcode_atts( array( |
| 475 |
|
'title' => esc_html_x( 'Directions', 'recipe', 'jetpack' ), // string. |
| 476 |
|
), $atts, 'recipe-directions' ); |
| 477 |
|
|
| 478 |
|
$html = '<div class="jetpack-recipe-directions">'; |
| 479 |
|
|
| 480 |
|
// Print a title unless the user has specified to exclude it. |
| 481 |
|
if ( 'false' !== $atts['title'] ) { |
| 482 |
|
$html .= '<h4 class="jetpack-recipe-directions-title">' . esc_html( $atts['title'] ) . '</h4>'; |
| 483 |
|
} |
| 484 |
|
|
| 485 |
|
// Format content using list functionality. |
| 486 |
|
$html .= self::output_list_content( $content, 'directions' ); |
| 487 |
|
|
| 488 |
|
$html .= '</div>'; |
| 489 |
|
|
| 490 |
|
// Sanitize html. |
| 491 |
|
$html = wp_kses_post( $html ); |
| 492 |
|
|
| 493 |
|
// Return the HTML block. |
| 494 |
|
return $html; |
| 495 |
|
} |
| 496 |
|
|
| 497 |
|
/** |
| 498 |
|
* Use $themecolors array to style the Recipes shortcode |