Shortcode in WYSIWYG type

Support General Shortcode in WYSIWYG type

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4698
    scherjonscherjon
    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..

    #4699
    scherjonscherjon
    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 TranAnh 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 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Shortcode in WYSIWYG type’ is closed to new replies.