I gave a talk the other night at the Boston WordPress meetup about how I use shortcodes to enable my clients to create better looking content.
A problem I was having was people were paying me to set them up on WordPress so they can take control of their content and then they were paying me even more to edit the content for them to “make it look pretty”. I guess if you need the business this isn’t a problem but I like to avoid small jobs, like manipulating content, so I can focus on my bigger projects and plugin support.
Pros and Cons of WordPress Shortcodes
Themes vs Plugins
The most popular implementation is currently in premium WordPress themes as a means of creating better looking content that matches the look and feel of the rest of the site. The problem then becomes you are tied to that theme if a majority of your site is relying on theme shortcodes to lay out your content. This won’t be a problem if you plan on rewriting your content but definitely something worth keeping in mind. It’s best to take functionality out of your theme you would like to be theme independent and put it in a functionality plugin.
My problem with using formatting shortcodes in a plugin as opposed to a theme is your content is less likely to match the look and feel of the rest of the site. That’s not to say their aren’t some great solutions out there and ultimately using a plugin will keep your content theme independent.
Usability
One of the obvious problems with shortcodes is if you’re taking the time to learn them, you can probably just learn HTML and CSS. I find this is true in most cases but not all. A shortcode is still easier to to use if you find the Visual/HTML editor confusing. You also don’t have to muck around with CSS.
One thing I think helps tremendously is the presence of a user interface to assist in the creation of the shortcodes. Most of the time this is in the form of a button on the visual editor that provides a popup with more options. There is no standard implementation of this so you won’t always have the luxury. More important is you now know it’s possible and can keep an eye out for how themes approach this problem. Most premium themes in ThemeForest do a good job of this.
Speed
If you don’t have to use shortcodes, just don’t use them. We’re talking milliseconds here in most cases so it really doesn’t matter too much. One problem with shortcodes is you cannot detect if a shortcode is being used in your content from your header so you can conditionally load javascript. You can however conditionally load javascript in the footer but it can be kind of a hack.
Resources
Code Snippets
- 10 incredibly cool WordPress shortcodes – Cats Who Code
- Mastering WordPress Shortcodes – Smashing Magazine
Advanced Development
Plugins & Themes
Slides from Boston WordPress Meetup
I used the [slideshare
] shortcode to display the slides!
Come to Boston WordCamp
I’ll be speaking more about shortcodes again at Boston WordCamp so be sure to go and sign up. I’ll be showing different examples of how businesses can use shortcodes to create better looking content. There are a bunch of other great speakers with some very interesting topics lined up. It’s sure to be a great time and an awesome place to get brushed up on all the latest WordPress tips and tricks.
2 replies on “WordPress and Shortcodes”
Excellent article. Presentation makes this article more important. thanks for sharing
[…] Creating Better Content w/ Shortcodes (slides here) […]