Created
February 19, 2021 18:39
-
-
Save schemapress/c6705d0678f4a0a738fa0d9679c45f67 to your computer and use it in GitHub Desktop.
Display a list of Recipe Instructions with the Schema plugin for WordPress https://schema.press/docs-premium/add-schema-org-recipe/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //* do not include php tag | |
/** | |
* Display Recipe Instructions | |
* | |
* @since 1.0.0 | |
* @return null | |
*/ | |
function schema_display_recipeInstructions_78239482379847() { | |
$output = ''; | |
$count = get_post_meta( get_the_ID(), 'schema_properties_Recipe_recipeInstructions', true ); | |
if ( isset( $count ) && $count >= 0 ) { | |
$output .= '<ul>'; | |
for( $i=0; $i < $count; $i++ ) { | |
$instructions = get_post_meta( get_the_ID(), 'schema_properties_Recipe_recipeInstructions_' . $i . '_recipeInstructions_item', true ); | |
if ( isset($instructions) && $instructions != '' ) { | |
$output .= '<li>' . $instructions . '</li>'; | |
} | |
} | |
$output .= '</ul>'; | |
} | |
if ( $output != '' ) { | |
echo $output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment