Custom Fields
Re-Envisioned
Support General Shortcode in WYSIWYG type

  • Creator
    Topic
  • #4698
    scherjon
    Participant

    I want use shortcodes in de 'wysiwyg' type. example: [contact-form-7 id="32" title="Contactform"]
    But nothing happens, i see only the code and not the contactform.

    I would not use een special field en then use de echo do_shortcode..

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #4699
    scherjon
    Participant

    i found de solution! i found this code:
    <?php echo apply_filters( 'the_content', rwmb_meta( 'wsmbox_page_two_columns_text' )); ?>
    the "wsmbox_page_two_columns_text" is the metabox field id.

    #4701
    Anh Tran
    Keymaster

    That's correct. The field doesn't apply any filters to make shortcode runs. The filter the_content does that. But you might want to use just do_shortcode() function as the_content often triggers some other unexpected functions (like social plugin might hook into it to insert social buttons).

    $text = rwmb_meta( 'wsmbox_page_two_columns_text' );
    echo do_shortcode( wpautop( $text ) );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode in WYSIWYG type’ is closed to new replies.