• Resolved myphixu

    (@myphixu)


    Dear support,

    how can I call an existing snippet (UNI) within another one (also UNI), please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Temyk

    (@webtemyk)

    Hello.

    <?php do_shortcode('[wbcr_snippet id="ID"]'); ?>

    • This reply was modified 5 years, 1 month ago by Temyk.
    Thread Starter myphixu

    (@myphixu)

    Thank you for the suggestion. I try to apply and it seems to be a silly bug in my code which I cannot figure out — do_shortcode() has no output:

    I broke it down to a minimal example:

    This snippet works in the post, [wbcr_snippet id=”3090″] (UNI, Where there is a shortcode):
    echo $content;

    The snippet does not have any output [wbcr_snippet id=”3091″] (UNI, Automatic insertion, Insert after post):

    global $post;
    $custom_field_content = get_post_meta($post->ID, 'custom_field_content', true);
    do_shortcode('[wbcr_snippet id="3090" title="echo content"]' . $custom_field_content . '[/wbcr_snippet]');
    echo "test5"; //a placeholder for debugging purposes

    The custom_field_content custom field contains a single string. Do you see any mismatch, please?

    Changing the 2nd line to
    do_shortcode('[wbcr_snippet id="3090" title="echo content"]test4[/wbcr_snippet]');
    does not display any result either.

    Plugin Support Temyk

    (@webtemyk)

    If you need to output a result, use
    <?php echo do_shortcode('[wbcr_snippet id="ID"]'); ?>

    • This reply was modified 5 years, 1 month ago by Temyk.
    Thread Starter myphixu

    (@myphixu)

    Thanks a million!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Call snippet in snippet’ is closed to new replies.