Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created January 11, 2019 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/530b2d118fb2758773df372c5c4cadb9 to your computer and use it in GitHub Desktop.
Save billerickson/530b2d118fb2758773df372c5c4cadb9 to your computer and use it in GitHub Desktop.
<?php
// Get the recipes inside this post.
global $post;
$recipes = WPRM_Recipe_Manager::get_recipe_ids_from_content( $post->post_content );
// Access the first recipe, if there is one.
if ( isset( $recipes[0] ) ) {
$recipe_id = $recipes[0];
$recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
// Output the recipe name.
echo $recipe->name();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment