{"id":19941,"date":"2012-09-22T15:05:11","date_gmt":"2012-09-22T15:05:11","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/shortcodes-generator\/"},"modified":"2014-03-15T19:28:23","modified_gmt":"2014-03-15T19:28:23","slug":"shortcodes-generator","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/shortcodes-generator\/","author":10268518,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.2.1","stable_tag":"trunk","tested":"3.7.41","requires":"3.0","requires_php":"","requires_plugins":"","header_name":"Shortcodes Generator","header_author":"Nathaniel Schweinberg","header_description":"","assets_banners_color":"","last_updated":"2014-03-15 19:28:23","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/bit.ly\/QhXuBc","header_plugin_uri":"http:\/\/fightthecurrent.org\/plugins\/shortcodes-generator","header_author_uri":"http:\/\/fightthecurrent.org","rating":1,"author_block_rating":0,"active_installs":10,"downloads":4416,"num_ratings":0,"support_threads":1,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":"1","2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.2","1.1","1.1.1"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[3020,2209,357,1141],"plugin_category":[43],"plugin_contributors":[88309],"plugin_business_model":[],"class_list":["post-19941","plugin","type-plugin","status-closed","hentry","plugin_tags-develop","plugin_tags-generator","plugin_tags-shortcodes","plugin_tags-theme","plugin_category-customization","plugin_contributors-fightthecurrent","plugin_committers-fightthecurrent"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/shortcodes-generator.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Adding shortcodes to the Visual Editor can be a pain in the buttocks. Not anymore.\nNow, you can add shortcodes and a button to the editor as simply as using an\narray and this plugin. <a href=\"http:\/\/bit.ly\/Pvj4ie\">How neat is that?<\/a><\/p>\n\n<p>You can check out more details on how to use the plugin, please visit <a href=\"http:\/\/fightthecurrent.org\/plugins\/shortcodes-generator\">the plugin site.<\/a><\/p>\n\n<p>Note: This plugin requires at LEAST PHP 5.3. If you're not sure what version of PHP you're using, consult your host.<\/p>\n\n<h3>Credits<\/h3>\n\n<p>Some icons by <a href=\"http:\/\/p.yusukekamiyamane.com\/\">Yusuke Kamiyamane<\/a>. All rights reserved. Licensed under a <a href=\"\/\/creativecommons.org\/licenses\/by\/3.0\/\">Creative Commons Attribution 3.0 License<\/a>.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>shortcodes-generator.zip<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory and unzip it<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Drag the <code>shortcodes<\/code> folder inside <code>shortcodes-generator<\/code> to the root of your theme<\/li>\n<li>Create your shortcode via arrays. For more details, check out the FAQ, or visit <a href=\"http:\/\/fightthecurrent.org\/plugins\/shortcodes-generator\">the plugin site.<\/a><\/li>\n<li>That's it! Enjoy!<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>So how do I add the shortcodes, anyway?<\/dt>\n<dd><p>Well, after you've moved the <code>shortcodes<\/code> folder to your theme, open up\n    shortcodes\/array.php. The simplest one you can make would look like this:<\/p>\n\n<pre><code>$shortcodes['button'] = array(\n    'shortcode' =&gt; 'button'\n);\n<\/code><\/pre>\n\n<p>That would create a shortcode that looks like this: <code>[button]<\/code><\/p>\n\n<p>Then, for every shortcode you wish to add, just repeat\n    $shortcodes['shortcode'] with the details filled in!<\/p>\n\n<p>The template is as follows:<\/p>\n\n<pre><code>$shortcodes['name'] = array(\n    'shortcode' =&gt; '',\n    'function' =&gt; '',\n    'tag'   =&gt; '',\n    'selectable' =&gt; 0\n    'atts' =&gt; array(\n        'name', 'name2'\n    ),\n    'children'=&gt; array(\n        'child' =&gt; array(\n            'shortcode' =&gt; '',\n            'function' =&gt; '',\n            'tag'   =&gt; '',\n            'selectable' =&gt; 0\n            'atts' =&gt; array(\n                  'name', 'name2'\n            ),\n        ),\n    )\n);\n<\/code><\/pre><\/dd>\n<dt>This seems too simple. What if I want more control?<\/dt>\n<dd><p>To use a specific function along with the short code, all you have to do is pass\n    'function' =&gt; 'function_name' as one of the paramaters for the array. Here's\nan example:<\/p>\n\n<pre><code>$shortcodes['button'] = array(\n    'shortcode' =&gt; 'button',\n    'function' =&gt; 'cur_button_shortcode',\n    'selectable' =&gt; 1\n    'atts' =&gt; array(\n        'class', 'color'\n    ),\n);\n<\/code><\/pre>\n\n<p>The shortcode will now use <code>cur_button_shortcode<\/code> as the function to run for\nthe shortcode. The shortcode will look like this:<\/p>\n\n<pre><code>[button class=\"\" color\"\"][\/button]\n<\/code><\/pre>\n\n<p>If you want to define some default parameters, just change atts to this:<\/p>\n\n<pre><code>'atts' =&gt; array(\n    'class' =&gt; 'small',\n    'color' =&gt; 'green'\n)\n<\/code><\/pre>\n\n<p>It will produce this output:<\/p>\n\n<pre><code>[button class=\"small\" color\"green\"][\/button]\n<\/code><\/pre>\n\n<p>Want to be able to select text and have the shortcode wrap around it? Just pass\n    'selectable' =&gt; 1.<\/p>\n\n<p>I will eventually add a ThickBox dialogue so that people can have default\nselections picked out for them, and actually have more of a UI. But this will\ndo for now.<\/p><\/dd>\n<dt>Is it possible to embed into themes?<\/dt>\n<dd><p>Sure is! To do that, move the plugin file into your theme and include this code\nin your functions.php file:<\/p>\n\n<pre><code>add_action( 'after_setup_theme', 'cur_shortcodes_theme_setup');\nfunction cur_shortcodes_theme_setup(){\n    \/\/ We're assuming the plugin directory is located in\n    \/\/ \/wp-content\/themes\/themename\/shortcodes-generator\/\n    define( 'CSG_URI', get_template_directory_uri() . '\/shortcodes-generator\/' );\n    require_once 'shortcodes-generator\/cur-shortcodes-generator.php';\n    $csg = Cur_Shortcodes_Generator::get_instance();\n}\n<\/code><\/pre>\n\n<p>It'll take care of the rest!<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.2.1<\/h4>\n\n<ul>\n<li>Added CSG_URI to more easily embed plugin into themes<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>BREAKING CHANGE: Changed params to atts in shortcode definition array<\/li>\n<li>Added cur_shortcode_atts so as to reduce repitition of shortcode attribute definitions. There was too much repition across array.php and functions.php<\/li>\n<li>Updated plugin to singleton pattern. Use Cur_Shortcodes_Generator::get_instance() to retreive instance of the class.<\/li>\n<li>Updated example array and functions<\/li>\n<\/ul>\n\n<h4>1.1.1<\/h4>\n\n<ul>\n<li>fixed error where functions weren't required in the correct order<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>editor_plugin.js is now stored in the theme's shortcodes directory.<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Fixed error where child shortcodes weren't being generated correctly.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Fixed error where functions weren't being included.<\/li>\n<li>Fixed issue where $tags wasn't being unset.<\/li>\n<li><\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial Release<\/li>\n<\/ul>","raw_excerpt":"A plugin to generate shortcodes and a corresponding button in the WordPress visual editor. Wicked!","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/19941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=19941"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/fightthecurrent"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=19941"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=19941"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=19941"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=19941"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=19941"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=19941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}