November 15, 2014 - Editor Tips, Shortcodes

CoL Theme Shortcodes[1]

We want to avoid theme-based shortcodes.[2]

The shortcodes defined in the theme are:

[gallery]

$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );

[button]        'type' => 'default', /* primary, default, info, success, danger, warning, inverse */

'size' => 'default', /* mini, small, default, large */

'url'  => '',

'text' => '',

[alert]         'type' => 'alert-info', /* alert-info, alert-success, alert-error */

'close' => 'false', /* display close link */

'text' => '',

[block-message]         'type' => 'alert-info', /* alert-info, alert-success, alert-error */

'close' => 'false', /* display close link */

'text' => '',

[blockquote] 'float' => '', /* left, right */ | 'cite' => '', /* text for cite */

Theme development[3]

While it is tempting to add features to themes, it is not a good idea.[4]  We have a great, low-overhead plug-in called "Shortcodes UI" where we can develop theme-independant shortcodes as needed. This also allow for easy linking to documentation about implemented shortcodes.

Our theme is based upon a "starter" theme called Sass WordPress Bootstrap


[1] See also https://codex.wordpress.org/Shortcode for built-in shortcodes

[2] Shortcode issues

In general, it is a bad practice to implement shortcodes in a WordPress theme. By doing so, it makes your content dependant on that theme, making changes to the web site awkward. It also raises upgrade compatibility problems. One example: the "core" GSU theme implements a

[video]

shortcode to embed videos. There are several plug-ins that also implement this shortcode. When WordPress was recently upgraded, it added a

[video]

shortcode that now conflicts with the theme-based shortcode. If it were a plugin, you could just uninstall the plug-in when upgrading WordPress - problem more easily solved.

[3] Background information The "Travelfy" theme we initially installed on insidelaw.gsu.edu had some minor issues, mainly with our "Groups Forum" plug-in. There was also the objective of making the Intranet experience as seamless as possible, so MindSing (Brian) was contracted to develop a new theme to match the GSU "department" theme.

[4] Theme "Features"

Theme development is fraught with complexities as developers pack more and more functionality into their themes to accommodate people who have tangential requirements for basically superficial web site functionality. GSU has painted itself into a corner with its theme development and Enablus now has us quite co-dependant on them to support the massive programming that is ensconced in their theme and hampering them from upgrading to the latest WordPress version.

Comments are closed.