Shortcode in shortcode: How to append variable?

You need to get the attributes of the shortcode, which is quite simple and documented in the add_shortcode() examples:

function wrapthecode( $attr ) {
    if( empty( $attr['id'] ) )
        return 'No ID given.';

    return do_shortcode('[contact-form-7 id="' . $attr['id'] . '"]');
}
add_shortcode( 'myform', 'wrapthecode' );

Leave a Comment

tech