Tag Archives: shortcode

SlideDeck Bumps

With new events coming up, it was time to replace the Slidedeck on the home page. This turned out to be more difficult than expected.

Firstly, the Insert SlideDeck button was hidden behind the Upgrade banner. When I moved that admin widget away from the sidebar to the main post column, the ‘Insert’ button became visible, but it didn’t work. Terribly irritating.

I remembered that all it did was to insert a shortcode into HTML view, but when I tried [Slidedeck], that didn’t work either. After firing up my development VM and checking the test page I had created, I realized that the shortcode is case sensitive.

For my own reference, and because all the information online was on how to use the ‘Insert’ button, the shortcode I’m using is below.

[SlideDeck id='xxxx' width='100%' height='250px'] Replace xxxx with the id number of the SlideDeck, which can be seen when editing it.

First Plugin!

I’ve written and contributed my first ever plugin! This was in response to a forum post asking for help in getting WordPress.com’s Google Maps shortcode to work. The user had moved over to a self-hosted WordPress.org and all the previously used shortcodes weren’t working.

My original solution was simply to add in the shortcode and get the shortcode handler to throw out the <iframe> code. The width and height was hardcoded and the ‘View Larger Map’ link wasn’t there, but the maps showed.

The very first draft of the plugin can be found in the pastebin.

The release version of the plugin supports variable widths and heights for the maps. It does this by finding the width and height of the original <iframe> then appending those values to the end of the URL stored in the shortcode, just like how it’s done on WordPress.com.

When the URL is parsed for output, those values are extracted and used to define the dimensions of the <iframe>.

Another important step which had to be taken was to move the execution of the shortcode up, before wpautop is called. If not, linebreaks will not be added correctly, causing the layout in the post to go haywire. Code to do this was adapted from http://www.viper007bond.com/tag/wpautop/

After all this talk, I’m sure you want to know where to find the plugin. It’s been uploaded to the official plugin repository.

I’ve also created a page on this blog which explains its purpose.

If you find it useful, do leave a comment and tell me about it 🙂