Registering Fields in the UI
-
Hi, i’m trying to add fields to my Shortcode UI, however i somehow fail to do it, maybe i’m missing something, the shortcode is in the media though, just the Class drop-down is not.
Your advanced shortcode ui in dev.php demo doesn’t work also.
<?php function span( $params, $content=null ) { extract( shortcode_atts( array( 'class' => 'col-sm-1' ), $params ) ); $result = '<div class="' . $class . '">'; $result .= do_shortcode( $content ); $result .= '</div>'; return force_balance_tags( $result ); } add_shortcode( 'col', 'span' ); function shortcode_ui_col() { // creating the field class $fileds = array( array( 'label' => 'Class', 'attr' => 'class', 'type' => 'select', 'options' => array( 'col-md-12' => esc_html__( 'Full Columns' ), 'col-md-11' => esc_html__( '11 Columns' ), 'col-md-10' => esc_html__( '10 Columns' ), 'col-md-9' => esc_html__( '9 Columns' ), 'col-md-8' => esc_html__( '8 Columns' ), 'col-md-7' => esc_html__( '7 Columns' ), 'col-md-6' => esc_html__( '6 Columns' ), 'col-md-5' => esc_html__( '5 Columns' ), 'col-md-4' => esc_html__( '4 Columns' ), 'col-md-3' => esc_html__( '3 Columns' ), 'col-md-2' => esc_html__( '2 Columns' ), 'col-md-1' => esc_html__( '1 Column' ), ), ), ); $shortcode_ui_args = array( 'label' => esc_html__( 'Columns' ), 'listItemImage' => 'dashicons-tagcloud', 'inner_content' => array( 'label' => esc_html__( 'The Columns' ), 'description' => esc_html__( 'Here Be The Columns' ), ), 'attrs' => $fields, ); shortcode_ui_register_for_shortcode( 'col', $shortcode_ui_args ); } add_action( 'register_shortcode_ui', 'shortcode_ui_col' ); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Registering Fields in the UI’ is closed to new replies.