Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save schemapress/c6705d0678f4a0a738fa0d9679c45f67 to your computer and use it in GitHub Desktop.
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/
<?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