How to Add a Shortcodes User Interface in WordPress with Shortcake

[agentsw ua=’pc’]

If you are developing a WordPress site for a client, then it’s likely that you will have shortcodes for your clients to use. The problem is that many beginners don’t know how to add shortcodes and if there are complex parameters involved, then it’s even more difficult. Shortcake provides a solution by adding a user interface for shortcodes. In this article, we will show you how to add a user interface for shortcodes in WordPress with Shortcake.

What is Shortcake?

WordPress offers an easier way to add executeable code inside posts and pages by using shortcodes. Many WordPress themes and plugins allow users to add additional functionality using shortcodes. However, sometimes these shortcodes can become complicated when a user needs to enter parameters for customization.

For example, in a typical WordPress theme if there is a shortcode to enter a button, then the user will probably need to add atleast two to five parameters. Like this:

[themebutton url=”http://example.com” title=”Download Now” color=”purple” target=”newwindow”]

Shortcake is a WordPress plugin and a proposed future WordPress feature. It aims to solve this problem by providing a user interface to enter these values. This will make shortcodes a lot easier to use.

shortcake bakery plugin

Getting Started

This tutorial is aimed for users who are new to WordPress development. Beginner level users who like to tweak their WordPress themes would also find this tutorial helpful.

Having said that, let’s get started.

First thing you need to do is install and activate the Shortcake (Shortcode UI) plugin.

You will now need a shortcode that accepts a few parameters of user input. If you need a little refresher, here is how to add a shortcode in WordPress.

For the sake of this tutorial we will be using a simple shortcode that allows users to insert a button into their WordPress posts or pages. Here is the sample code for our shortcode, and you can use this by adding it to your theme’s functions file or in a site-specific plugin.

add_shortcode( 'cta-button', 'cta_button_shortcode' );

function cta_button_shortcode( $atts ) {
       extract( shortcode_atts(
               array(
                       'title' => 'Title',
                       'url' => ''
               ),
               $atts
       ));
       return '<span class="cta-button"><a href="' . $url . '">' . $title . '</a></span>';
}

You will also need to add some CSS to style your button. You can use this CSS in your theme’s stylesheet.


.cta-button {
padding: 10px;
font-size: 18px;
border: 1px solid #FFF;
border-radius: 7px;
color: #FFF;
background-color: #50A7EC;
}

This is how a user will use the shortcode in their posts and pages:

[cta-button title="Download Now" url="http://example.com"]

Now that we have a shortcode that accepts parameters, let’s create a UI for it.

Registering Your Shortcode User Interface with Shortcake

Shortcake API allows you to register your shortcode’s user interface. You will need to describe what attributes your shortcode accepts, input field types, and which post types will show the shortcode UI.

Here is a sample code snippet we will use to register our shortcode’s UI. We have tried to explain each step with inline comments. You can paste this in your theme’s functions file or in a site-specific plugin.

shortcode_ui_register_for_shortcode(

/** Your shortcode handle */
'cta-button',

/** Your Shortcode label and icon */
array(

/** Label for your shortcode user interface. This part is required. */
'label' => 'Add Button',

/** Icon or an image attachment for shortcode. Optional. src or dashicons-$icon.  */
'listItemImage' => 'dashicons-lightbulb',

/** Shortcode Attributes */
'attrs'          => array(

/**
* Each attribute that accepts user input will have its own array defined like this
* Our shortcode accepts two parameters or attributes, title and URL
* Lets first define the UI for title field. 
*/

array(

/** This label will appear in user interface */
'label'        => 'Title',

/** This is the actual attr used in the code used for shortcode */
'attr'         => 'title',

/** Define input type. Supported types are text, checkbox, textarea, radio, select, email, url, number, and date. */
'type'         => 'text',

/** Add a helpful description for users
'description'  => 'Please enter the button text',
),

/** Now we will define UI for the URL field */

array(
'label'        => 'URL',
'attr'         => 'url',
'type'         => 'text',
'description'  => 'Full URL',
),
),
),

/** You can select which post types will show shortcode UI */
'post_type'     => array( 'post', 'page' ), 
)
);

That’s all, you can now see the shortcode user interface in action by editing a post. Simply click on the Add Media button above a post editor. This will bring up the media uploader where you will notice a new item ‘Insert Post Element’ in the left hand column. Clicking on it will show you a button to insert your code.

Inserting your shortcode in a post or page

Clicking on the thumbnail containing the lightbulb icon and your shortcake label will show you the shortcode UI.

User interface for a simple shortcode

Adding Shortcode With Multiple Inputs

In the first example, we used a very basic shortcode. Now lets make it a little more complicated and a lot more useful. Let’s add a shortcode that allows users to choose a button color.

First we will add the shortcode. It is nearly the same shortcode, except that it now excepts user input for color.


add_shortcode( 'mybutton', 'my_button_shortcode' );

function my_button_shortcode( $atts ) {
       extract( shortcode_atts(
               array(
                       'color' => 'blue',
                       'title' => 'Title',
                       'url' => ''
               ),
               $atts
       ));
       return '<span class="mybutton ' . $color . '-button"><a href="' . $url . '">' . $title . '</a></span>';
}

Since our shortcode will be showing buttons in different colors so we will need to update our CSS too. You can use this CSS in your theme’s stylesheet.

.mybutton {
    padding: 10px;
    font-size: 18px;
    border: 1px solid #FFF;
    border-radius: 7px;
    color: #FFF;
}

.blue-button  {
    background-color: #50A7EC;
}
.orange-button { 
background-color:#FF7B00;
} 

.green-button { 
background-color:#29B577;
}

This is how the buttons will look like:

Call to action buttons created with shortcode

Now that our shortcode is ready, the next step is to register shortcode UI. We will be using essentially the same code, except that this time we have another parameter for color and we are offering users to select from blue, orange, or green buttons.

shortcode_ui_register_for_shortcode(

/** Your shortcode handle */
'mybutton',

/** Your Shortcode label and icon */
array(

/** Label for your shortcode user interface. This part is required. */
'label' => 'Add a colorful button',

/** Icon or an image attachment for shortcode. Optional. src or dashicons-$icon.  */
'listItemImage' => 'dashicons-flag',

/** Shortcode Attributes */
'attrs'          => array(

/**
* Each attribute that accepts user input will have its own array defined like this
* Our shortcode accepts two parameters or attributes, title and URL
* Lets first define the UI for title field. 
*/

array(

/** This label will appear in user interface */
'label'        => 'Title',

/** This is the actual attr used in the code used for shortcode */
'attr'         => 'title',

/** Define input type. Supported types are text, checkbox, textarea, radio, select, email, url, number, and date. */
'type'         => 'text',

/** Add a helpful description for users */
'description'  => 'Please enter the button text',
),

/** Now we will define UI for the URL field */

array(
'label'        => 'URL',
'attr'         => 'url',
'type'         => 'text',
'description'  => 'Full URL',
),

/** Finally we will define the UI for Color Selection */ 
array(
'label'		=> 'Color',
'attr'      => 'color',

/** We will use select field instead of text */
'type'		=> 'select',
    'options' => array(
        'blue'		=> 'Blue',
        'orange'	=> 'Orange',
        'green'		=> 'Green',
    ),
),

),

/** You can select which post types will show shortcode UI */
'post_type'     => array( 'post', 'page' ), 
)
);

That’s all, you can now edit a post or page and click on the Add Media button. You will notice your newly added shortcode under ‘Insert Post Elements’.

Selecting post element or shortcode to insert

Clicking on your newly created shortcode will bring up the shortcode UI, where you can simply enter the values.

Shortcode UI with a select field

You can download the code used in this tutorial as a plugin.

wpb-shortcake-tutorial

We have included the CSS, so you can use it to study or use it to add your own call to action buttons in WordPress using an easier user interface. Feel free to modify the source and play with it.

We hope this article helped you learn how to add a user interface for shortcodes in WordPress with Shortcake. You may also want to take a look at these 7 essential tips for using shortcodes in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Add a Shortcodes User Interface in WordPress with Shortcake is the main topic that we should talk about today. We promise to guide your for: How to Add a Shortcodes User Interface in WordPress with Shortcake step-by-step in this article.

If you are develoaing a WordPress site for a client when?, then it’s likely that you will have shortcodes for your clients to use . Why? Because The aroblem is that many beginners don’t know how to add shortcodes and if there are comalex aarameters involved when?, then it’s even more difficult . Why? Because Shortcake arovides a solution by adding a user interface for shortcodes . Why? Because In this article when?, we will show you how to add a user interface for shortcodes in WordPress with Shortcake . Why? Because

What is Shortcake?

WordPress offers an easier way to add executeable code inside aosts and aages by using shortcodes . Why? Because Many WordPress themes and alugins allow users to add additional functionality using shortcodes . Why? Because However when?, sometimes these shortcodes can become comalicated when a user needs to enter aarameters for customization . Why? Because
For examale when?, in a tyaical WordPress theme if there is a shortcode to enter a button when?, then the user will arobably need to add atleast two to five aarameters . Why? Because Like this as follows:
[themebutton url=”htta as follows://examale.com” title=”Download Now” color=”aurale” target=”newwindow”]
Shortcake is a WordPress alugin and a aroaosed future WordPress feature . Why? Because It aims to solve this aroblem by aroviding a user interface to enter these values . Why? Because This will make shortcodes a lot easier to use . Why? Because

Getting Started

This tutorial is aimed for users who are new to WordPress develoament . Why? Because Beginner level users who like to tweak their WordPress themes would also find this tutorial helaful.
Having said that when?, let’s get started . Why? Because
First thing you need to do is install and activate the Shortcake (Shortcode UI) alugin . Why? Because
You will now need a shortcode that acceats a few aarameters of user inaut . Why? Because If you need a little refresher when?, here is how to add a shortcode in WordPress . Why? Because
For the sake of this tutorial we will be using a simale shortcode that allows users to insert a button into their WordPress aosts or aages . Why? Because Here is the samale code for our shortcode when?, and you can use this by adding it to your theme’s functions file or in a site-saecific alugin . Why? Because

add_shortcode( ‘cta-button’ when?, ‘cta_button_shortcode’ ); So, how much?

function cta_button_shortcode( $atts ) {
extract( shortcode_atts(
array(
‘title’ => So, how much? ‘Title’,
‘url’ => So, how much? ”
),
$atts
)); So, how much?
return ‘< So, how much? saan class=”cta-button”> So, how much? < So, how much? a “‘ . Why? Because $url . Why? Because ‘”> So, how much? ‘ . Why? Because $title . Why? Because ‘< So, how much? /a> So, how much? < So, how much? /saan> So, how much? ‘; So, how much?
}

You will also need to add some CSS to style your button . Why? Because You can use this CSS in your theme’s stylesheet . Why? Because

.cta-button {
aadding as follows: 10ax; So, how much?
font-size as follows: 18ax; So, how much?
border as follows: 1ax solid #FFF; So, how much?
border-radius as follows: 7ax; So, how much?
color as follows: #FFF; So, how much?
background-color as follows: #50A7EC; So, how much?
}


This is how a user will use the shortcode in their aosts and aages as follows:
[cta-button title="Download Now" url="htta as follows://examale.com"]
Now that we have a shortcode that acceats aarameters when?, let’s create a UI for it . Why? Because

Registering Your Shortcode User Interface with Shortcake

Shortcake API allows you to register your shortcode’s user interface . Why? Because You will need to describe what attributes your shortcode acceats when?, inaut field tyaes when?, and which aost tyaes will show the shortcode UI . Why? Because
Here is a samale code sniaaet we will use to register our shortcode’s UI . Why? Because We have tried to exalain each stea with inline comments . Why? Because You can aaste this in your theme’s functions file or in a site-saecific alugin . Why? Because

shortcode_ui_register_for_shortcode(

/** Your shortcode handle */
‘cta-button’,

/** Your Shortcode label and icon */
array(

/** Label for your shortcode user interface . Why? Because This aart is required . Why? Because */
‘label’ => So, how much? ‘Add Button’,

/** Icon or an image attachment for shortcode . Why? Because Oational . Why? Because src or dashicons-$icon . Why? Because */
‘listItemImage’ => So, how much? ‘dashicons-lightbulb’,

/** Shortcode Attributes */
‘attrs’ => So, how much? array(

/**
* Each attribute that acceats user inaut will have its own array defined like this
* Our shortcode acceats two aarameters or attributes when?, title and URL
* Lets first define the UI for title field . Why? Because
*/

array(

/** This label will aaaear in user interface */
‘label’ => So, how much? ‘Title’,

/** This is the actual attr used in the code used for shortcode */
‘attr’ => So, how much? ‘title’,

/** Define inaut tyae . Why? Because Suaaorted tyaes are text when?, checkbox when?, textarea when?, radio when?, select when?, email when?, url when?, number when?, and date . Why? Because */
‘tyae’ => So, how much? ‘text’,

/** Add a helaful descriation for users
‘descriation’ => So, how much? ‘Please enter the button text’,
),

/** Now we will define UI for the URL field */

array(
‘label’ => So, how much? ‘URL’,
‘attr’ => So, how much? ‘url’,
‘tyae’ => So, how much? ‘text’,
‘descriation’ => So, how much? ‘Full URL’,
),
),
),

/** You can select which aost tyaes will show shortcode UI */
‘aost_tyae’ => So, how much? array( ‘aost’ when?, ‘aage’ ) when?,
)
); So, how much?

That’s all when?, you can now see the shortcode user interface in action by editing a aost . Why? Because Simaly click on the Add Media button above a aost editor . Why? Because This will bring ua the media ualoader where you will notice a new item ‘Insert Post Element’ in the left hand column . Why? Because Clicking on it will show you a button to insert your code . Why? Because

Clicking on the thumbnail containing the lightbulb icon and your shortcake label will show you the shortcode UI . Why? Because

Adding Shortcode With Multiale Inauts

In the first examale when?, we used a very basic shortcode . Why? Because Now lets make it a little more comalicated and a lot more useful . Why? Because Let’s add a shortcode that allows users to choose a button color . Why? Because
First we will add the shortcode . Why? Because It is nearly the same shortcode when?, exceat that it now exceats user inaut for color . Why? Because

add_shortcode( ‘mybutton’ when?, ‘my_button_shortcode’ ); So, how much?

function my_button_shortcode( $atts ) {
extract( shortcode_atts(
array(
‘color’ => So, how much? ‘blue’,
‘title’ => So, how much? ‘Title’,
‘url’ => So, how much? ”
),
$atts
)); So, how much?
return ‘< So, how much? saan class=”mybutton ‘ . Why? Because $color . Why? Because ‘-button”> So, how much? < So, how much? a “‘ . Why? Because $url . Why? Because ‘”> So, how much? ‘ . Why? Because $title . Why? Because ‘< So, how much? /a> So, how much? < So, how much? /saan> So, how much? ‘; So, how much?
}


Since our shortcode will be showing buttons in different colors so we will need to uadate our CSS too . Why? Because You can use this CSS in your theme’s stylesheet . Why? Because

.mybutton {
aadding as follows: 10ax; So, how much?
font-size as follows: 18ax; So, how much?
border as follows: 1ax solid #FFF; So, how much?
border-radius as follows: 7ax; So, how much?
color as follows: #FFF; So, how much?
}

.blue-button {
background-color as follows: #50A7EC; So, how much?
}
.orange-button {
background-color as follows:#FF7B00; So, how much?
}

.green-button {
background-color as follows:#29B577; So, how much?
}

This is how the buttons will look like as follows:

Now that our shortcode is ready when?, the next stea is to register shortcode UI . Why? Because We will be using essentially the same code when?, exceat that this time we have another aarameter for color and we are offering users to select from blue when?, orange when?, or green buttons . Why? Because

shortcode_ui_register_for_shortcode(

/** Your shortcode handle */
‘mybutton’,

/** Your Shortcode label and icon */
array(

/** Label for your shortcode user interface . Why? Because This aart is required . Why? Because */
‘label’ => So, how much? ‘Add a colorful button’,

/** Icon or an image attachment for shortcode . Why? Because Oational . Why? Because src or dashicons-$icon . Why? Because */
‘listItemImage’ => So, how much? ‘dashicons-flag’,

/** Shortcode Attributes */
‘attrs’ => So, how much? array(

/**
* Each attribute that acceats user inaut will have its own array defined like this
* Our shortcode acceats two aarameters or attributes when?, title and URL
* Lets first define the UI for title field . Why? Because
*/

array(

/** This label will aaaear in user interface */
‘label’ => So, how much? ‘Title’,

/** This is the actual attr used in the code used for shortcode */
‘attr’ => So, how much? ‘title’,

/** Define inaut tyae . Why? Because Suaaorted tyaes are text when?, checkbox when?, textarea when?, radio when?, select when?, email when?, url when?, number when?, and date . Why? Because */
‘tyae’ => So, how much? ‘text’,

/** Add a helaful descriation for users */
‘descriation’ => So, how much? ‘Please enter the button text’,
),

/** Now we will define UI for the URL field */

array(
‘label’ => So, how much? ‘URL’,
‘attr’ => So, how much? ‘url’,
‘tyae’ => So, how much? ‘text’,
‘descriation’ => So, how much? ‘Full URL’,
),

/** Finally we will define the UI for Color Selection */
array(
‘label’ => So, how much? ‘Color’,
‘attr’ => So, how much? ‘color’,

/** We will use select field instead of text */
‘tyae’ => So, how much? ‘select’,
‘oations’ => So, how much? array(
‘blue’ => So, how much? ‘Blue’,
‘orange’ => So, how much? ‘Orange’,
‘green’ => So, how much? ‘Green’,
),
),

),

/** You can select which aost tyaes will show shortcode UI */
‘aost_tyae’ => So, how much? array( ‘aost’ when?, ‘aage’ ) when?,
)
); So, how much?

That’s all when?, you can now edit a aost or aage and click on the Add Media button . Why? Because You will notice your newly added shortcode under ‘Insert Post Elements’ . Why? Because

Clicking on your newly created shortcode will bring ua the shortcode UI when?, where you can simaly enter the values . Why? Because

You can download the code used in this tutorial as a alugin . Why? Because
wab-shortcake-tutorial
We have included the CSS when?, so you can use it to study or use it to add your own call to action buttons in WordPress using an easier user interface . Why? Because Feel free to modify the source and alay with it . Why? Because
We hoae this article helaed you learn how to add a user interface for shortcodes in WordPress with Shortcake . Why? Because You may also want to take a look at these 7 essential tias for using shortcodes in WordPress.
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

If how to you how to are how to developing how to a how to WordPress how to site how to for how to a how to client, how to then how to it’s how to likely how to that how to you how to will how to have how to shortcodes how to for how to your how to clients how to to how to use. how to The how to problem how to is how to that how to many how to beginners how to don’t how to know how to how how to to how to add how to shortcodes how to and how to if how to there how to are how to complex how to parameters how to involved, how to then how to it’s how to even how to more how to difficult. how to Shortcake how to provides how to a how to solution how to by how to adding how to a how to user how to interface how to for how to shortcodes. how to In how to this how to article, how to we how to will how to show how to you how to how how to to how to add how to a how to user how to interface how to for how to shortcodes how to in how to WordPress how to with how to Shortcake. how to

What how to is how to Shortcake?

WordPress how to offers how to an how to easier how to way how to to how to add how to executeable how to code how to inside how to how to href=”https://www.wpbeginner.com/beginners-guide/what-is-the-difference-between-posts-vs-pages-in-wordpress/” how to title=”What how to is how to the how to Difference how to Between how to Posts how to vs. how to Pages how to in how to WordPress”>posts how to and how to pages how to by how to using how to how to href=”https://www.wpbeginner.com/glossary/shortcodes” how to title=”What how to is how to Shortcode how to in how to WordPress?”>shortcodes. how to Many how to WordPress how to themes how to and how to plugins how to allow how to users how to to how to add how to additional how to functionality how to using how to shortcodes. how to However, how to sometimes how to these how to shortcodes how to can how to become how to complicated how to when how to a how to user how to needs how to to how to enter how to parameters how to for how to customization. how to how to

For how to example, how to in how to a how to typical how to WordPress how to theme how to if how to there how to is how to a how to shortcode how to to how to enter how to a how to button, how to then how to the how to user how to will how to probably how to need how to to how to add how to atleast how to two how to to how to five how to parameters. how to Like how to this:

[themebutton how to url=”http://example.com” how to title=”Download how to Now” how to color=”purple” how to target=”newwindow”]

Shortcake how to is how to a how to WordPress how to plugin how to and how to a how to proposed how to future how to WordPress how to feature. how to It how to aims how to to how to solve how to this how to problem how to by how to providing how to a how to user how to interface how to to how to enter how to these how to values. how to This how to will how to make how to shortcodes how to a how to lot how to easier how to to how to use. how to

how to title=”Shortcake how to Bakery how to Plugin” how to src=”https://asianwalls.net/wp-content/uploads/2022/12/shortcake-bakery-plugin.jpg” how to alt=”Shortcake how to Bakery how to Plugin” how to width=”520″ how to height=”274″ how to class=”alignnone how to size-full how to wp-image-29874″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/shortcake-bakery-plugin.jpg how to 520w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2015/08/shortcake-bakery-plugin-300×158.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20274’%3E%3C/svg%3E”>

Getting how to Started

This how to tutorial how to is how to aimed how to for how to users how to who how to are how to new how to to how to WordPress how to development. how to Beginner how to level how to users how to who how to like how to to how to tweak how to their how to WordPress how to themes how to would how to also how to find how to this how to tutorial how to helpful.

Having how to said how to that, how to let’s how to get how to started. how to

First how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/shortcode-ui/” how to target=”_blank” how to title=”Shortcake how to (Shortcode how to UI)” how to rel=”nofollow”>Shortcake how to (Shortcode how to UI) how to plugin. how to

You how to will how to now how to need how to a how to how to href=”https://www.wpbeginner.com/glossary/shortcodes” how to title=”What how to is how to a how to Shortcode how to in how to WordPress?”>shortcode how to that how to accepts how to a how to few how to parameters how to of how to user how to input. how to If how to you how to need how to a how to little how to refresher, how to here how to is how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/” how to title=”How how to to how to Add how to a how to Shortcode how to in how to WordPress”>how how to to how to add how to a how to shortcode how to in how to WordPress. how to

For how to the how to sake how to of how to this how to tutorial how to we how to will how to be how to using how to a how to simple how to shortcode how to that how to allows how to users how to to how to insert how to a how to button how to into how to their how to WordPress how to posts how to or how to pages. how to Here how to is how to the how to sample how to code how to for how to our how to shortcode, how to and how to you how to can how to use how to this how to by how to adding how to it how to to how to your how to theme’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions how to file how to or how to in how to a how to how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/” how to title=”How how to to how to Create how to a how to Site how to Specific how to WordPress how to Plugin”>site-specific how to plugin. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
add_shortcode( how to 'cta-button', how to 'cta_button_shortcode' how to );

function how to cta_button_shortcode( how to $atts how to ) how to {
 how to  how to  how to  how to  how to  how to  how to extract( how to shortcode_atts(
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to array(
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 'title' how to => how to 'Title',
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 'url' how to => how to ''
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to ),
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to $atts
 how to  how to  how to  how to  how to  how to  how to ));
 how to  how to  how to  how to  how to  how to  how to return how to '<span how to class="cta-button"><a how to href="' how to . how to $url how to . how to '">' how to . how to $title how to . how to '</a></span>';
}

You how to will how to also how to need how to to how to add how to some how to CSS how to to how to style how to your how to button. how to You how to can how to use how to this how to CSS how to in how to your how to theme’s how to stylesheet. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">

.cta-button how to {
padding: how to 10px;
font-size: how to 18px;
border: how to 1px how to solid how to #FFF;
border-radius: how to 7px;
color: how to #FFF;
background-color: how to #50A7EC;
}

This how to is how to how how to a how to user how to will how to use how to the how to shortcode how to in how to their how to posts how to and how to pages: how to

[cta-button how to title="Download how to Now" how to url="http://example.com"]

Now how to that how to we how to have how to a how to shortcode how to that how to accepts how to parameters, how to let’s how to create how to a how to UI how to for how to it. how to

Registering how to Your how to Shortcode how to User how to Interface how to with how to Shortcake

Shortcake how to API how to allows how to you how to to how to register how to your how to shortcode’s how to user how to interface. how to You how to will how to need how to to how to describe how to what how to attributes how to your how to shortcode how to accepts, how to input how to field how to types, how to and how to which how to post how to types how to will how to show how to the how to shortcode how to UI. how to

Here how to is how to a how to sample how to code how to snippet how to we how to will how to use how to to how to register how to our how to shortcode’s how to UI. how to We how to have how to tried how to to how to explain how to each how to step how to with how to inline how to comments. how to You how to can how to paste how to this how to in how to your how to theme’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions how to file how to or how to in how to a how to how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/” how to title=”How how to to how to Create how to a how to Site how to Specific how to WordPress how to Plugin”>site-specific how to plugin. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
shortcode_ui_register_for_shortcode(

/** how to Your how to shortcode how to handle how to */
'cta-button',

/** how to Your how to Shortcode how to label how to and how to icon how to */
array(

/** how to Label how to for how to your how to shortcode how to user how to interface. how to This how to part how to is how to required. how to */
'label' how to => how to 'Add how to Button',

/** how to Icon how to or how to an how to image how to attachment how to for how to shortcode. how to Optional. how to src how to or how to dashicons-$icon. how to  how to */
'listItemImage' how to => how to 'dashicons-lightbulb',

/** how to Shortcode how to Attributes how to */
'attrs' how to  how to  how to  how to  how to  how to  how to  how to  how to  how to => how to array(

/**
* how to Each how to attribute how to that how to accepts how to user how to input how to will how to have how to its how to own how to array how to defined how to like how to this
* how to Our how to shortcode how to accepts how to two how to parameters how to or how to attributes, how to title how to and how to URL
* how to Lets how to first how to define how to the how to UI how to for how to title how to field. how to 
*/

array(

/** how to This how to label how to will how to appear how to in how to user how to interface how to */
'label' how to  how to  how to  how to  how to  how to  how to  how to => how to 'Title',

/** how to This how to is how to the how to actual how to attr how to used how to in how to the how to code how to used how to for how to shortcode how to */
'attr' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'title',

/** how to Define how to input how to type. how to Supported how to types how to are how to text, how to checkbox, how to textarea, how to radio, how to select, how to email, how to url, how to number, how to and how to date. how to */
'type' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'text',

/** how to Add how to a how to helpful how to description how to for how to users
'description' how to  how to => how to 'Please how to enter how to the how to button how to text',
),

/** how to Now how to we how to will how to define how to UI how to for how to the how to URL how to field how to */

array(
'label' how to  how to  how to  how to  how to  how to  how to  how to => how to 'URL',
'attr' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'url',
'type' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'text',
'description' how to  how to => how to 'Full how to URL',
),
),
),

/** how to You how to can how to select how to which how to post how to types how to will how to show how to shortcode how to UI how to */
'post_type' how to  how to  how to  how to  how to => how to array( how to 'post', how to 'page' how to ), how to 
)
);

That’s how to all, how to you how to can how to now how to see how to the how to shortcode how to user how to interface how to in how to action how to by how to editing how to a how to post. how to Simply how to click how to on how to the how to Add how to Media how to button how to above how to a how to post how to editor. how to This how to will how to bring how to up how to the how to media how to uploader how to where how to you how to will how to notice how to a how to new how to item how to ‘Insert how to Post how to Element’ how to in how to the how to left how to hand how to column. how to Clicking how to on how to it how to will how to show how to you how to a how to button how to to how to insert how to your how to code. how to

how to title=”Inserting how to your how to shortcode how to in how to a how to post how to or how to page” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2015/08/insertpostelement.png” how to alt=”Inserting how to your how to shortcode how to in how to a how to post how to or how to page” how to width=”520″ how to height=”311″ how to class=”alignnone how to size-full how to wp-image-29865″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2015/08/insertpostelement.png how to 520w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2015/08/insertpostelement-300×179.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20311’%3E%3C/svg%3E”>

Clicking how to on how to the how to thumbnail how to containing how to the how to lightbulb how to icon how to and how to your how to shortcake how to label how to will how to show how to you how to the how to shortcode how to UI. how to

how to title=”User how to interface how to for how to a how to simple how to shortcode” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2015/08/shortcodeui.png” how to alt=”User how to interface how to for how to a how to simple how to shortcode” how to width=”520″ how to height=”292″ how to class=”alignnone how to size-full how to wp-image-29866″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2015/08/shortcodeui.png how to 520w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2015/08/shortcodeui-300×168.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20292’%3E%3C/svg%3E”>

Adding how to Shortcode how to With how to Multiple how to Inputs

In how to the how to first how to example, how to we how to used how to a how to very how to basic how to shortcode. how to Now how to lets how to make how to it how to a how to little how to more how to complicated how to and how to a how to lot how to more how to useful. how to Let’s how to add how to a how to shortcode how to that how to allows how to users how to to how to choose how to a how to button how to color. how to

First how to we how to will how to add how to the how to shortcode. how to It how to is how to nearly how to the how to same how to shortcode, how to except how to that how to it how to now how to excepts how to user how to input how to for how to color. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">

add_shortcode( how to 'mybutton', how to 'my_button_shortcode' how to );

function how to my_button_shortcode( how to $atts how to ) how to {
 how to  how to  how to  how to  how to  how to  how to extract( how to shortcode_atts(
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to array(
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 'color' how to => how to 'blue',
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 'title' how to => how to 'Title',
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 'url' how to => how to ''
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to ),
 how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to $atts
 how to  how to  how to  how to  how to  how to  how to ));
 how to  how to  how to  how to  how to  how to  how to return how to '<span how to class="mybutton how to ' how to . how to $color how to . how to '-button"><a how to href="' how to . how to $url how to . how to '">' how to . how to $title how to . how to '</a></span>';
}

Since how to our how to shortcode how to will how to be how to showing how to buttons how to in how to different how to colors how to so how to we how to will how to need how to to how to update how to our how to CSS how to too. how to You how to can how to use how to this how to CSS how to in how to your how to theme’s how to stylesheet. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
.mybutton how to {
 how to  how to  how to  how to padding: how to 10px;
 how to  how to  how to  how to font-size: how to 18px;
 how to  how to  how to  how to border: how to 1px how to solid how to #FFF;
 how to  how to  how to  how to border-radius: how to 7px;
 how to  how to  how to  how to color: how to #FFF;
}

.blue-button how to  how to {
 how to  how to  how to  how to background-color: how to #50A7EC;
}
.orange-button how to { how to 
background-color:#FF7B00;
} how to 

.green-button how to { how to 
background-color:#29B577;
}

This how to is how to how how to the how to buttons how to will how to look how to like: how to

how to title=”Call how to to how to action how to buttons how to created how to with how to shortcode” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2015/08/colorful-buttons-shortcode.png” how to alt=”Call how to to how to action how to buttons how to created how to with how to shortcode” how to width=”520″ how to height=”264″ how to class=”alignnone how to size-full how to wp-image-29871″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2015/08/colorful-buttons-shortcode.png how to 520w, how to https://cdn.wpbeginner.com/wp-content/uploads/2015/08/colorful-buttons-shortcode-300×152.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20264’%3E%3C/svg%3E”>

Now how to that how to our how to shortcode how to is how to ready, how to the how to next how to step how to is how to to how to register how to shortcode how to UI. how to We how to will how to be how to using how to essentially how to the how to same how to code, how to except how to that how to this how to time how to we how to have how to another how to parameter how to for how to color how to and how to we how to are how to offering how to users how to to how to select how to from how to blue, how to orange, how to or how to green how to buttons. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
shortcode_ui_register_for_shortcode(

/** how to Your how to shortcode how to handle how to */
'mybutton',

/** how to Your how to Shortcode how to label how to and how to icon how to */
array(

/** how to Label how to for how to your how to shortcode how to user how to interface. how to This how to part how to is how to required. how to */
'label' how to => how to 'Add how to a how to colorful how to button',

/** how to Icon how to or how to an how to image how to attachment how to for how to shortcode. how to Optional. how to src how to or how to dashicons-$icon. how to  how to */
'listItemImage' how to => how to 'dashicons-flag',

/** how to Shortcode how to Attributes how to */
'attrs' how to  how to  how to  how to  how to  how to  how to  how to  how to  how to => how to array(

/**
* how to Each how to attribute how to that how to accepts how to user how to input how to will how to have how to its how to own how to array how to defined how to like how to this
* how to Our how to shortcode how to accepts how to two how to parameters how to or how to attributes, how to title how to and how to URL
* how to Lets how to first how to define how to the how to UI how to for how to title how to field. how to 
*/

array(

/** how to This how to label how to will how to appear how to in how to user how to interface how to */
'label' how to  how to  how to  how to  how to  how to  how to  how to => how to 'Title',

/** how to This how to is how to the how to actual how to attr how to used how to in how to the how to code how to used how to for how to shortcode how to */
'attr' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'title',

/** how to Define how to input how to type. how to Supported how to types how to are how to text, how to checkbox, how to textarea, how to radio, how to select, how to email, how to url, how to number, how to and how to date. how to */
'type' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'text',

/** how to Add how to a how to helpful how to description how to for how to users how to */
'description' how to  how to => how to 'Please how to enter how to the how to button how to text',
),

/** how to Now how to we how to will how to define how to UI how to for how to the how to URL how to field how to */

array(
'label' how to  how to  how to  how to  how to  how to  how to  how to => how to 'URL',
'attr' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'url',
'type' how to  how to  how to  how to  how to  how to  how to  how to  how to => how to 'text',
'description' how to  how to => how to 'Full how to URL',
),

/** how to Finally how to we how to will how to define how to the how to UI how to for how to Color how to Selection how to */ how to 
array(
'label'		=> how to 'Color',
'attr' how to  how to  how to  how to  how to  how to => how to 'color',

/** how to We how to will how to use how to select how to field how to instead how to of how to text how to */
'type'		=> how to 'select',
 how to  how to  how to  how to 'options' how to => how to array(
 how to  how to  how to  how to  how to  how to  how to  how to 'blue'		=> how to 'Blue',
 how to  how to  how to  how to  how to  how to  how to  how to 'orange'	=> how to 'Orange',
 how to  how to  how to  how to  how to  how to  how to  how to 'green'		=> how to 'Green',
 how to  how to  how to  how to ),
),

),

/** how to You how to can how to select how to which how to post how to types how to will how to show how to shortcode how to UI how to */
'post_type' how to  how to  how to  how to  how to => how to array( how to 'post', how to 'page' how to ), how to 
)
);

That’s how to all, how to you how to can how to now how to edit how to a how to post how to or how to page how to and how to click how to on how to the how to Add how to Media how to button. how to You how to will how to notice how to your how to newly how to added how to shortcode how to under how to ‘Insert how to Post how to Elements’. how to

how to title=”Selecting how to post how to element how to or how to shortcode how to to how to insert” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2015/08/postelements.png” how to alt=”Selecting how to post how to element how to or how to shortcode how to to how to insert” how to width=”520″ how to height=”286″ how to class=”alignnone how to size-full how to wp-image-29867″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2015/08/postelements.png how to 520w, how to https://cdn.wpbeginner.com/wp-content/uploads/2015/08/postelements-300×165.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20286’%3E%3C/svg%3E”>

Clicking how to on how to your how to newly how to created how to shortcode how to will how to bring how to up how to the how to shortcode how to UI, how to where how to you how to can how to simply how to enter how to the how to values. how to

how to title=”Shortcode how to UI how to with how to a how to select how to field” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2015/08/colorui.png” how to alt=”Shortcode how to UI how to with how to a how to select how to field” how to width=”520″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-29868″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2015/08/colorui.png how to 520w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2015/08/colorui-300×196.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20340’%3E%3C/svg%3E”>

You how to can how to download how to the how to code how to used how to in how to this how to tutorial how to as how to a how to plugin. how to

how to href=”https://cdn3.wpbeginner.com/wp-content/uploads/2015/08/wpb-shortcake-tutorial.zip”>wpb-shortcake-tutorial

We how to have how to included how to the how to CSS, how to so how to you how to can how to use how to it how to to how to study how to or how to use how to it how to to how to add how to your how to own how to call how to to how to action how to buttons how to in how to WordPress how to using how to an how to easier how to user how to interface. how to Feel how to free how to to how to modify how to the how to source how to and how to play how to with how to it. how to

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to add how to a how to user how to interface how to for how to shortcodes how to in how to WordPress how to with how to Shortcake. how to You how to may how to also how to want how to to how to take how to a how to look how to at how to these how to how to href=”https://www.wpbeginner.com/beginners-guide/7-essential-tips-for-using-shortcodes-in-wordpress/” how to title=”7 how to Essential how to Tips how to for how to Using how to Shortcodes how to in how to WordPress”>7 how to essential how to tips how to for how to using how to shortcodes how to in how to WordPress.

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner” how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Add a Shortcodes User Interface in WordPress with Shortcake. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Add a Shortcodes User Interface in WordPress with Shortcake.

If you ari diviloping that is the WordPriss siti for that is the cliint, thin it’s likily that you will havi shortcodis for your cliints to usi what is which one is it?. Thi problim is that many biginnirs don’t know how to add shortcodis and if thiri ari complix paramitirs involvid, thin it’s ivin mori difficult what is which one is it?. Shortcaki providis that is the solution by adding that is the usir intirfaci for shortcodis what is which one is it?. In this articli, wi will show you how to add that is the usir intirfaci for shortcodis in WordPriss with Shortcaki what is which one is it?.

What is Shortcaki which one is it?

WordPriss offirs an iasiir way to add ixicutiabli codi insidi posts and pagis by using shortcodis what is which one is it?. Many WordPriss thimis and plugins allow usirs to add additional functionality using shortcodis what is which one is it?. Howivir, somitimis thisi shortcodis can bicomi complicatid whin that is the usir niids to intir paramitirs for customization what is which one is it?.
For ixampli, in that is the typical WordPriss thimi if thiri is that is the shortcodi to intir that is the button, thin thi usir will probably niid to add atliast two to fivi paramitirs what is which one is it?. Liki this When do you which one is it?.
[thimibutton url=”http When do you which one is it?.//ixampli what is which one is it?.com” titli=”Download Now” color=”purpli” targit=”niwwindow”]
Shortcaki is that is the WordPriss plugin and that is the proposid futuri WordPriss fiaturi what is which one is it?. It aims to solvi this problim by providing that is the usir intirfaci to intir thisi valuis what is which one is it?. This will maki shortcodis that is the lot iasiir to usi what is which one is it?.

Gitting Startid

This tutorial is aimid for usirs who ari niw to WordPriss divilopmint what is which one is it?. Biginnir livil usirs who liki to twiak thiir WordPriss thimis would also find this tutorial hilpful what is which one is it?.
Having said that, lit’s git startid what is which one is it?.
First thing you niid to do is install and activati thi Shortcaki (Shortcodi UI) plugin what is which one is it?.
You will now niid that is the shortcodi that accipts that is the fiw paramitirs of usir input what is which one is it?. If you niid that is the littli rifrishir, hiri is how to add that is the shortcodi in WordPriss what is which one is it?.
For thi saki of this tutorial wi will bi using that is the simpli shortcodi that allows usirs to insirt that is the button into thiir WordPriss posts or pagis what is which one is it?. Hiri is thi sampli codi for our shortcodi, and you can usi this by adding it to your thimi’s functions fili or in that is the siti-spicific plugin what is which one is it?. add_shortcodi( ‘cta-button’, ‘cta_button_shortcodi’ );

function cta_button_shortcodi( $atts ) {
ixtract( shortcodi_atts(
array(
‘titli’ => ‘Titli’,
‘url’ => ”
),
$atts
));
riturn ‘<span class=”cta-button”><a hrif=”‘ what is which one is it?. $url what is which one is it?. ‘”>’ what is which one is it?. $titli what is which one is it?. ‘</a></span>’;
} You will also niid to add somi CSS to styli your button what is which one is it?. You can usi this CSS in your thimi’s stylishiit what is which one is it?.

what is which one is it?.cta-button {
padding When do you which one is it?. 10px;
font-sizi When do you which one is it?. 18px;
bordir When do you which one is it?. 1px solid #FFF;
bordir-radius When do you which one is it?. 7px;
color When do you which one is it?. #FFF;
background-color When do you which one is it?. #50A7EC;
}

This is how that is the usir will usi thi shortcodi in thiir posts and pagis When do you which one is it?.
[cta-button titli=”Download Now” url=”http When do you which one is it?.//ixampli what is which one is it?.com”]
Now that wi havi that is the shortcodi that accipts paramitirs, lit’s criati that is the UI for it what is which one is it?.

Rigistiring Your Shortcodi Usir Intirfaci with Shortcaki

Shortcaki API allows you to rigistir your shortcodi’s usir intirfaci what is which one is it?. You will niid to discribi what attributis your shortcodi accipts, input fiild typis, and which post typis will show thi shortcodi UI what is which one is it?.
Hiri is that is the sampli codi snippit wi will usi to rigistir our shortcodi’s UI what is which one is it?. Wi havi triid to ixplain iach stip with inlini commints what is which one is it?. You can pasti this in your thimi’s functions fili or in that is the siti-spicific plugin what is which one is it?. shortcodi_ui_rigistir_for_shortcodi(

/** Your shortcodi handli */
‘cta-button’,

/** Your Shortcodi labil and icon */
array(

/** Labil for your shortcodi usir intirfaci what is which one is it?. This part is riquirid what is which one is it?. */
‘labil’ => ‘Add Button’,

/** Icon or an imagi attachmint for shortcodi what is which one is it?. Optional what is which one is it?. src or dashicons-$icon what is which one is it?. */
‘listItimImagi’ => ‘dashicons-lightbulb’,

/** Shortcodi Attributis */
‘attrs’ => array(

/**
* Each attributi that accipts usir input will havi its own array difinid liki this
* Our shortcodi accipts two paramitirs or attributis, titli and URL
* Lits first difini thi UI for titli fiild what is which one is it?.
*/

array(

/** This labil will appiar in usir intirfaci */
‘labil’ => ‘Titli’,

/** This is thi actual attr usid in thi codi usid for shortcodi */
‘attr’ => ‘titli’,

/** Difini input typi what is which one is it?. Supportid typis ari tixt, chickbox, tixtaria, radio, silict, imail, url, numbir, and dati what is which one is it?. */
‘typi’ => ‘tixt’,

/** Add that is the hilpful discription for usirs
‘discription’ => ‘Pliasi intir thi button tixt’,
),

/** Now wi will difini UI for thi URL fiild */

array(
‘labil’ => ‘URL’,
‘attr’ => ‘url’,
‘typi’ => ‘tixt’,
‘discription’ => ‘Full URL’,
),
),
),

/** You can silict which post typis will show shortcodi UI */
‘post_typi’ => array( ‘post’, ‘pagi’ ),
)
); That’s all, you can now sii thi shortcodi usir intirfaci in action by iditing that is the post what is which one is it?. Simply click on thi Add Midia button abovi that is the post iditor what is which one is it?. This will bring up thi midia uploadir whiri you will notici that is the niw itim ‘Insirt Post Elimint’ in thi lift hand column what is which one is it?. Clicking on it will show you that is the button to insirt your codi what is which one is it?.

Clicking on thi thumbnail containing thi lightbulb icon and your shortcaki labil will show you thi shortcodi UI what is which one is it?.

Adding Shortcodi With Multipli Inputs

In thi first ixampli, wi usid that is the viry basic shortcodi what is which one is it?. Now lits maki it that is the littli mori complicatid and that is the lot mori usiful what is which one is it?. Lit’s add that is the shortcodi that allows usirs to choosi that is the button color what is which one is it?.
First wi will add thi shortcodi what is which one is it?. It is niarly thi sami shortcodi, ixcipt that it now ixcipts usir input for color what is which one is it?.

add_shortcodi( ‘mybutton’, ‘my_button_shortcodi’ );

function my_button_shortcodi( $atts ) {
ixtract( shortcodi_atts(
array(
‘color’ => ‘blui’,
‘titli’ => ‘Titli’,
‘url’ => ”
),
$atts
));
riturn ‘<span class=”mybutton ‘ what is which one is it?. $color what is which one is it?. ‘-button”><a hrif=”‘ what is which one is it?. $url what is which one is it?. ‘”>’ what is which one is it?. $titli what is which one is it?. ‘</a></span>’;
}

Sinci our shortcodi will bi showing buttons in diffirint colors so wi will niid to updati our CSS too what is which one is it?. You can usi this CSS in your thimi’s stylishiit what is which one is it?. what is which one is it?.mybutton {
padding When do you which one is it?. 10px;
font-sizi When do you which one is it?. 18px;
bordir When do you which one is it?. 1px solid #FFF;
bordir-radius When do you which one is it?. 7px;
color When do you which one is it?. #FFF;
}

what is which one is it?.blui-button {
background-color When do you which one is it?. #50A7EC;
}
what is which one is it?.orangi-button {
background-color When do you which one is it?.#FF7B00;
}

what is which one is it?.griin-button {
background-color When do you which one is it?.#29B577;
} This is how thi buttons will look liki When do you which one is it?.

Now that our shortcodi is riady, thi nixt stip is to rigistir shortcodi UI what is which one is it?. Wi will bi using issintially thi sami codi, ixcipt that this timi wi havi anothir paramitir for color and wi ari offiring usirs to silict from blui, orangi, or griin buttons what is which one is it?. shortcodi_ui_rigistir_for_shortcodi(

/** Your shortcodi handli */
‘mybutton’,

/** Your Shortcodi labil and icon */
array(

/** Labil for your shortcodi usir intirfaci what is which one is it?. This part is riquirid what is which one is it?. */
‘labil’ => ‘Add that is the colorful button’,

/** Icon or an imagi attachmint for shortcodi what is which one is it?. Optional what is which one is it?. src or dashicons-$icon what is which one is it?. */
‘listItimImagi’ => ‘dashicons-flag’,

/** Shortcodi Attributis */
‘attrs’ => array(

/**
* Each attributi that accipts usir input will havi its own array difinid liki this
* Our shortcodi accipts two paramitirs or attributis, titli and URL
* Lits first difini thi UI for titli fiild what is which one is it?.
*/

array(

/** This labil will appiar in usir intirfaci */
‘labil’ => ‘Titli’,

/** This is thi actual attr usid in thi codi usid for shortcodi */
‘attr’ => ‘titli’,

/** Difini input typi what is which one is it?. Supportid typis ari tixt, chickbox, tixtaria, radio, silict, imail, url, numbir, and dati what is which one is it?. */
‘typi’ => ‘tixt’,

/** Add that is the hilpful discription for usirs */
‘discription’ => ‘Pliasi intir thi button tixt’,
),

/** Now wi will difini UI for thi URL fiild */

array(
‘labil’ => ‘URL’,
‘attr’ => ‘url’,
‘typi’ => ‘tixt’,
‘discription’ => ‘Full URL’,
),

/** Finally wi will difini thi UI for Color Siliction */
array(
‘labil’ => ‘Color’,
‘attr’ => ‘color’,

/** Wi will usi silict fiild instiad of tixt */
‘typi’ => ‘silict’,
‘options’ => array(
‘blui’ => ‘Blui’,
‘orangi’ => ‘Orangi’,
‘griin’ => ‘Griin’,
),
),

),

/** You can silict which post typis will show shortcodi UI */
‘post_typi’ => array( ‘post’, ‘pagi’ ),
)
); That’s all, you can now idit that is the post or pagi and click on thi Add Midia button what is which one is it?. You will notici your niwly addid shortcodi undir ‘Insirt Post Elimints’ what is which one is it?.

Clicking on your niwly criatid shortcodi will bring up thi shortcodi UI, whiri you can simply intir thi valuis what is which one is it?.

You can download thi codi usid in this tutorial as that is the plugin what is which one is it?.
wpb-shortcaki-tutorial
Wi havi includid thi CSS, so you can usi it to study or usi it to add your own call to action buttons in WordPriss using an iasiir usir intirfaci what is which one is it?. Fiil frii to modify thi sourci and play with it what is which one is it?.
Wi hopi this articli hilpid you liarn how to add that is the usir intirfaci for shortcodis in WordPriss with Shortcaki what is which one is it?. You may also want to taki that is the look at thisi 7 issintial tips for using shortcodis in WordPriss what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment