• Resolved joshkern

    (@joshkern)


    I thought I could use the wprm_recipe_summary_shortcode (wprm_recipe_name_shortcode) to check if $output was empty, then get the parent post excerpt to use as the summary. However, it seems like this filter doesn’t run if the summary is empty. Am I missing something?

    I was trying to use this in a roundup list.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brecht

    (@brechtvds)

    Hi there,

    You’re right. The filter only gets applied if there actually is any output at the moment. It would make sense to change that for a next update.

    We do have the wprm_recipe_field filter hook as well. That could be used to change what the $recipe->summary() function returns:

    function adjust_recipe_summary( $value, $field, $recipe ) {
    if ( 'summary' === $field ) {
    if ( ! $value ) {
    $parent_post_id = $recipe->parent_post_id();

    if ( $parent_post_id ) {
    ...
    }
    }
    }

    return $value;
    }
    add_filter( 'wprm_recipe_field', 'adjust_recipe_summary', 10, 3 );
    Thread Starter joshkern

    (@joshkern)

    Worked great, thank you!

    Plugin Author Brecht

    (@brechtvds)

    Hi again,

    I wanted to let you know we just released WP Recipe Maker 9.7.0 which does now apply that filter hook when the shortcode output is empty as well.

    You can learn more about other changes in the update here: https://bootstrapped.ventures/wp-recipe-maker-9-7-0/

    Kind regards,
    Brecht

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.