Wiki

Clone wiki

Shortcode Ultimate V2 / Inner API / get_config()

To get options of shortcode that is showing in window of shortcode and to define shortcode name, desc, icon, type, you can use this get_config() function.

Example

<?php 

static function get_config() {

        return array(
            'name'  => 'New Heading',
            'type'  => 'wrap',
            'group' => 'content',
            'content' => 'Your heading text here',
            'desc'    => "This is new Custom Heading Shortcode.",
            'icon'    => 'h-square',
            'atts'  => array(               

                'size' => array(
                    'type'    => 'slider',
                    'min'     => 7,
                    'max'     => 48,
                    'step'    => 1,
                    'default' => 16,
                    'name'    => 'Size',
                    'desc'    => 'Select Your Font Size from here'
                ),

                'class' => array(
                    'default' => '',
                    'name'    => 'Class',
                    'desc'    => 'If you want to add extra CSS class for this element so type here'
                )
            )
        );
    }

?>

Array Description

Param Name Description
name Name is the title of this shortcode
type There are two type 1. wrap and 2. single. if have there any content of this shortcode, you must put "wrap" example: [new_heading]your content here[/new_heading]. Otherwise if there is no need any content you need to write "single". Example: [icon icon="icon: home"]. here "icon" has no content for this reason it's type is single.
group What kind of shortcode is it, we define by using this group. Actually it work as filtering. when we click "Insert Shortcode" button. All shortcodes are showing there with some filter button like content, box, media, gallery, other etc. So we can use content/box/media/gallery for it.
content Here you can set default content of this shortcode.
icon When you will go shortcode window, we see shortcodes with icon. you can set any icon of Font Awesome.
atts Here is explained all Attributes(i mean options) of this shortcode. Example: size, class etc. you will see these option when you click "insert Shortcode" > "New Heading". you can put here size of this heading and class.
  • Available Attribute Type(I mean that Return Array => atts => size => type) There are some type that you can use like- slider(for set number that will set by dragging),color(for color selection),icon(for icon selection),select(for certain value select), border(for border assignment),shadow(for shadow), bool(for switch button). Note: if you do not want to use any type(like class attribute). you will get a text box where you can add anything.

Updated