2023 Update
The WordPress Dictionary Plugin was one of my first commercial WordPress projects. It started as a tutorial, which you can still read below. After much demand I published the original Dictionary plugin - the first of its kind - which later expanded to theme and then a premium SEO service which used the plugin to create powerful internal linking. Since then, I have moved onto other opportunities and no longer focus on these projects.
Therefore, this plugin is no longer maintained but if for some reason you prefer it over other options, you can still purchase the archived version as-is at DictionaryPlugin.com.
Original Tutorial from Oct. 8th, 2009
Recently, I helped launch a website that served as a silly custom dictionary.
The concept was simple enough: create an online dictionary using only custom definitions. At first, I did some Google searches to see if there were any open-source dictionary apps. No such luck!
Then it occurred to me I should try WordPress. Searching the plugins, I realized that there was no dictionary plugin there either. That's when I realized that I could set up WordPress itself to run the dictionary entirely.
Organization
I laid out a plan to make sure this would all run smoothly. I would use:
- Posts: for definition entries
- Custom Fields: to separate definitions, emphasis, etc. (made useful in combination with the "Get Custom Field Values" plugin)
- Categories: to create letter listing pages
- WP Post Sorting: a plugin to list entries in alphabetical order on letter listing pages
- Custom Template: to display the information correctly, in dictionary fashion instead of like a blog
Setting Up
Now that I had my game plan, it was time to prep. I installed WordPress, and set up my categories. I took advantage of nested categories in case I decide to run a blog simultaneously on the site. To do that, I created a "definitions" category, with nested categories running A-Z.
Next, I installed the WP Post Sorting plugin, and set it up so that under the A-Z categories, entries would be listed alphabetically instead of by the usual date order.
Then it was time to set up custom fields. I went over to create a new post. I put in the word to be defined as the title, and skipped the usual post box, scrolling down to the custom fields section. You can use whatever information you want but I created a different field for each of the following:
- Definition
- Emphasis
- Origin
- Type (noun/adjective/etc)
Finally, I went to set up the permalinks. You can set it up however you choose, but I used the following settings:
-
Custom structure:
/define/%postname%
-
Category base:
list
-
Tag base:
tag
Creating a custom theme
Creating the theme is pretty simple, once you get the hang of it. If you don't know how to build a theme, I suggest you learn how first.
I don't care how you style it, but here are some tips to setting this up:
- Install Scott Reilly's Get Custom Field Values plugin, it will make your life easier. Then, all you have to do to pull the custom field is something like the following (used within the loop):
<?php echo c2c_get_custom('definition', ''); ?>
- Re-write the code that spits out posts. You're not using the_content(), but we do want to show the definitions of our entries! My code looks like the following: [php][/php] Origin: This code should be used pretty much anywhere on the blog that would normally just display the posts.
- You'll probably want to have a "Browse" option showing links for the A-Z categories somewhere. To do this, I simply used the following in header.php:
Browse:
<ul>
<?php wp_list_categories('child_of=3&hide_empty=0&title_li='); ?>
</ul>
Simply substitute the "3" after child_of with whatever the category ID "Definitions" is on your setup of WordPress, and this will display a list of the A-Z links.
From there on out, you're on your own! If you have any questions or tips of your own, feel free to leave them in the comments.
If you're interested, you can check out the finished product at Pugtionary (the dictionary for pugs). Unfortunately, the Pugtionary is no longer available.