How to create a shortcode/edit a function to solve the conflict between Bootstrap and wpautop in Wordpress

后端 未结 1 1656
梦如初夏
梦如初夏 2021-01-28 17:04

Following on from my previously unsolved question How to show Bootstrap Buttons inline instead of one per line in Wordpress Specifically? and after extensive research in this p

相关标签:
1条回答
  • 2021-01-28 17:21

    This is the function that I am using to output the test buttons.

    add_shortcode('show_boot_buttons', 'func_show_buttons');
    
    function func_show_buttons( $atts ) {
        $atts = shortcode_atts(
            array(
                'class' => 'btn',
                'text' => 'Press Me',
            ), $atts, 'show_boot_buttons' );
    
        return '<button type="button" class="btn ' . esc_html( $atts['class'] ) .'">'. esc_html( $atts['text'] ). '</button>';
    }
    

    You can insert a button with the following code example.

    [show_boot_buttons class="btn-primary" text="Press This"]
    
    0 讨论(0)
提交回复
热议问题