Shortcodes Generator

Contributors: fightthecurrent
Donate link:
Tags: shortcodes, theme, generator, develop
Requires at least: 3.0
Tested up to: 3.8.1
Stable tag: 1.2.1

A plugin to generate shortcodes and a corresponding button in the WordPress visual editor. Wicked!


Adding shortcodes to the Visual Editor can be a pain in the buttocks. Not anymore.
Now, you can add shortcodes and a button to the editor as simply as using an
array and this plugin. How neat is that?

To check out more details on how to use the plugin, please visit the plugin site.

Note: This plugin requires at LEAST PHP 5.3. If you’re not sure what version of PHP you’re using, consult your host.


Some icons by Yusuke Kamiyamane. All rights reserved. Licensed under a Creative Commons Attribution 3.0 License.


  1. Upload to the /wp-content/plugins/ directory and unzip it
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Drag the shortcodes folder inside shortcodes-generator to the root of your theme
  4. Create your shortcode via arrays. For more details, check out the FAQ, or visit the plugin site.
  5. That’s it! Enjoy!

Frequently Asked Questions

So how do I add the shortcodes, anyway?

Well, after you’ve moved the shortcodes folder to your theme, open up
shortcodes/array.php. The simplest one you can make would look like this:

That would create a shortcode that looks like this: Button Text

Then, for every shortcode you wish to add, just repeat
$shortcodes['shortcode'] with the details filled in!

The template is as follows:

This seems too simple. What if I want more control?

To use a specific function along with the short code, all you have to do is pass
'function' => 'function_name' as one of the paramaters for the array. Here’s
an example:

The shortcode will now use cur_button_shortcode as the function to run for
the shortcode. The shortcode will look like this:

If you want to define some default parameters, just change atts to this:

It will produce this output:

Want to be able to select text and have the shortcode wrap around it? Just pass
'selectable' => 1.

I will eventually add a ThickBox dialogue so that people can have default
selections picked out for them, and actually have more of a UI. But this will
do for now.

Is it possible to embed into themes?

Sure is! To do that, move the plugin file into your theme and include this code
in your functions.php file:

It’ll take care of the rest!



  • Added CSG_URI to more easily embed plugin into themes


  • BREAKING CHANGE: Changed params to atts in shortcode definition array
  • Added cur_shortcode_atts so as to reduce repitition of shortcode attribute definitions. There was too much repition across array.php and functions.php
  • Updated plugin to singleton pattern. Use Cur_Shortcodes_Generator::get_instance() to retreive instance of the class.
  • Updated example array and functions


  • fixed error where functions weren’t required in the correct order


  • editor_plugin.js is now stored in the theme’s shortcodes directory.


  • Fixed error where child shortcodes weren’t being generated correctly.


  • Fixed error where functions weren’t being included.
  • Fixed issue where $tags wasn’t being unset.


  • Initial Release


  1. Shortcodes Generator | Really cool wordpress theme |
    September 22, 2012

    [...] You can check out more details on how to use the plugin, please visit the plugin site. [...]

  2. Tomáš Kapler
    September 23, 2012

    This plugin is exactly the think i wanted to create several times but i haven’t got time to. Actually i think, that this should be part of core, WP still got easy function to only put button to non-wysiwyg editor, as it was few years ago when WP did not have wysiwyg at all.
    Just IMO the installation is not for 99,99% users a d the same for button creation. I wonder that there may be some very easy form with all the fields, which would simply generate code to be inserted to user’s functions.php.

  3. flickapix
    May 17, 2013

    this cool, thanx for the share and time saver, any where near completing the modal window?

    • Nathaniel
      May 29, 2013

      Sadly, no. ThemeZilla released their shortcodes plugin which this was loosely based on. Seeing as this has been released, I’m going to recommend using theirs as it does a lot of what I wanted to do. I may or may not redo mine later on as they don’t quite have it the way I want it =)

  4. Unas
    June 11, 2013

    I’m still confuse how to use this

  5. Patrik
    November 28, 2013

    I think this plugin is brilliant. The fact that I can so easily add my own shortcodes by merely using an array is awesome.

    I was unable to find any docs regarding Zilla’s plugin, which means it’s useless for someone who wants to use it to add their own shortcodes. I surely don’t feel like reading through their code to perhaps figure it out.

    I think you should continue developing this awesome plugin.

    Q: How do I add a shortcode that doesn’t require a closing bracket segment?

    • Nathaniel
      January 9, 2014

      Hey Patrick! I deeply apologize for not responding… I usually assume any comments I get are spam, but yours wasn’t! I’d be happy to explain it to you if you’re still interested…

  6. Firestorm
    March 30, 2014

    Any likelihood of updating for wp 3.9 as they have updated to tinymce 4.0 and this doesn’t work in the current beta

    • Nathaniel
      March 31, 2014

      Hey Firestorm! I’ll have to take a look at TinyMCE’s new api to see. I’ll shoot you an update on github when I know more!

  7. Parvez
    April 16, 2014

    Can i use it for themeforest themes?

    • Nathaniel
      April 16, 2014

      Sure can! Feel free!


Leave a Reply