Custom Fields
Re-Envisioned
Support Meta Box Builder My Shortcode in a Custom HTML field

  • Creator
    Topic
  • #29287
    Resolved Yumikom
    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,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #29288
    Long 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
    Yumikom
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.