Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Last active April 27, 2021 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingram3541/6e071e6dccfb00c8119134da75dda98c to your computer and use it in GitHub Desktop.
Save pingram3541/6e071e6dccfb00c8119134da75dda98c to your computer and use it in GitHub Desktop.
Mediavine custom Create Recipe Jump-To button using $post_id
//Shortcode to output custom Jump-To Recipe button by Create
function custom_mvcreate_jumpbutton_func(){
$post_id = get_the_ID();
if( ! function_exists( 'mv_get_post_creations' ) )
return;
$recipes = mv_get_post_creations( $post_id );
if( empty( $recipes ) )
return;
$recipe = $recipes[0]; //first recipe ID
if( ! function_exists( 'mv_create_get_creation' ) )
return;
$type_of_card = mv_create_get_creation( $recipe );
return do_shortcode( '[mv_create_jtr id="' . $recipe . '" type="' . $type_of_card->type . '"]' );
}
add_shortcode('mv_jump_button', 'custom_mvcreate_jumpbutton_func');
//use: [mv_jump_button]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment