Project Preview Shortcode

When I first started figuring out the key features that I really wanted to include in my portfolio theme, among them were a way to display my work in a simplified format. I needed support for a featured image, a title, and a brief blurb regarding the project. So, I created the ft_project shortcode.

The shortcode is fairly simple. The usage looks like this (with indentation, since the URLs are quite large):

	The JavaScript library behind the counters on this site.

If you notice, I’m not using quotations to pass strings to each of the parameters (e.g. label=Radial*Counters). This is due to a change in the behavior of the shortcodes in WordPress Core. Shortcodes no longer function properly with quotations, so my solution is to use asterisks. After the concatenated string is sent to the ft_project shortcode callback, the string is split and spaced properly. It can then be properly displayed on screen.

The code above renders as the following, just like on the front-page:

The JavaScript library behind the counters on this site.