My Shortcode in a Custom HTML field

Support MB Builder My Shortcode in a Custom HTML fieldResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29287
    YumikomYumikom
    Participant

    Hi,

    I want to run my own Shortcode in Custom HTML of custom field, I have embedded [SHOW_MY_HTML] shortcode in Custom HTML field but it is not running.
    Please let me know what field I should set.

    Best regards,

    #29288
    Long NguyenLong Nguyen
    Moderator

    Hi Yumikom,

    You can create a function to execute the shortcode and add the function name to the callback option of the field custom_html. For example:

    function foobar_func( $atts ){
        return "foo and bar";
    }
    add_shortcode( 'foobar', 'foobar_func' );
    
    function show_shortcode() {
        echo do_shortcode('[foobar]');
    }

    Screenshot https://share.getcloudapp.com/9ZudygdW

    #29291
    YumikomYumikom
    Participant

    Hi Long,

    I will change it to use Shortcode in the Callback field.
    Thank you for letting me know that it cannot be done in the HTML field.

    Thanks,
    Yumikom

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