While porting ucnorfolk.org to WordPress, I learned about WordPress short codes. Short codes are magic strings that cause WordPress to insert content in a post or page.
References
Motivation
As I began writing the blog, I had a bit of a dilemma: where did I put something? If it was a blog post, it disappeared into the archive after a few posts. If I made a page, the material never appeared on the front page. I encountered this first when I decided to torment my aunts with the Yankee Greens recipe. I needed to keep it around so I could make it again.
WordPress offers a solution
You can assign a post to a category. WordPress can retrieve posts by category. There’s a widget for that in the primary sidebar to the left. But did you know that WordPress can insert stuff into posts for you? Well, It can.
WordPress short codes let you do this. Short codes are magic strings inside square brackets that tell a WordPress plugin to do something for you. One of the things it can do is display posts that match a criterion like “Category”. Interestingly, I had been assigning my posts to categories.
WordPress plugins make short codes available. With luck, the plugin’s documentation describes the short codes that it offers and explains how to use each. The WordPress.com reference provides a list of of short codes available in a WordPress.com site with links to the user instructions for short code.
The display posts short code plugin causes WordPress to retrieve a list of posts by category that it inserts into the post or page. Short code arguments tell the display posts plugin what to retrieve, how many to retrieve, and how to format the results. Problem solved. Write a page that pulls post excerpts by category. Now I had a page with abstracts of each post assigned to the category.
Other short codes let you interact with Facebook, Twitter, YouTube, and others. You can have a lot of fun amazing your friends with creative use of short codes in pages, posts, and text widgets.
New Navigation
As I began making new top level pages for each category I wanted to feature, I discovered that I had way too many of them for the main menu. So I made a page about the Moocher’s interests and made the category pages subpages of it. Now folks can find stuff I think is important that I’ve buried in the the compost heap of the blog.