Making a Glossary Without a Plugin in WordPress

March 12th, 2010 · 15 Comments · Category: Our Love Affair w/ WP

Although I’m a big fan of “plugin and forget about it”, I’m also a proponent of “less is more”, the fewer plugins the better. Why? Less updates and less possible conflicts between WordPress plugins. With that said I introduce to you a new way of manipulating WordPress to your advantage by creating a glossary without a WordPress plugin.

I recently created a glossary of recipes for a client and had quite a good time with it. This was actually a second glossary. The first was your typical alphabetical directory of terms created as posts and categorized in A-C, D-G, H-K, etc blocks. This recipes glossary, however, was categorized by courses such as breakfast, dinner, etc. Both types, alphabetical and categorical, require the same method which I will outline below.

I’ll outline the basics below and give some detail. The rest is up to your skill level and/or imagination. Ready?

For this demonstration, let’s pretend we need a for WordPress PAD for the best timeless WordPress plugins. We want to make this glossary easily searchable and categorized by five main areas: posts, commenting, SEO, social networking, design.

Maybe some of you are thinking, ‘Hey dufus, isn’t categorizing by categories or tags standard in WordPress!’ Well, to that I say, how’d you know my name? But seriously, this WordPress tutorial is about working with WordPress’ current functionality to make your WordPress blog installation work like a modulated CMS, and in this case, sans a plugin. Who’s the dufus now? I kid.

Step 1:

So, step 1 in creating a WordPress glossary without a plugin is first you must make a decision whether you want glossary items to show up in regular post archives such as those on the home page, category archives, post archives, etc., or you don’t. The first option requires manipulating the archive template, which itself deserves a different tutorial. So, let’s go with option 2 which requires what I call “standard WordPress manipulation techniques” that the average WordPress developer or WordPress “tinkerer” might now.

Three pages will be created: two pages using page.php template, and a third page using the single.php template with a design layout almost identical to the two pages just mentioned.

But first, we will create 6 pages in wp-admin and 6 categories as well. Each page will be “mapped” to a category. I’ll explain this later.

So, I’ll create the parent page “Timeless WordPress Plugins Glossary”, and then the five main areas – posts, commenting, SEO, social networking, and design – as child pages. I’ll Do the same for categories where “timeless wordPress plugins” will be the main category and the five main areas will be child/sub categories. So, your new pages and categories should be set up as such:

Timeless WordPress Plugins (parent)
>Posts (child)
>Comments (child)
>SEO (child)
>Social Networking (child)
>Design

Step 2:

Step 2 requires creating a page for the glossay landing/home page. To illustrate simply, let’s say we use your default page.php template. Copy it and name it something like “glossary.php” wit a template title “Glossary”. Create a layout with the title of the page, a description box area below the title, 5 inline links below the description box, and then the area for posts underneath. See the example below:

LoveAffair-MakingAGlossary

This page has three main elements besides the title of the page:

  • The page description: a custom field created in the “Timeless WordPress Plugins Glossary” page and called onto the page with the get_post_meta(); tag
  • The glossary navigation: an inline list of links that go to each child/sub page of the glossary. I suggest added this glossary navigation as an include since it will be used on the second page outlined in Step 3 below. Also, when creating the glossary, a good design and user friendly element would be to add if else statements that highlight the link a different color, or has something different about it, when the user is on that page as seen in the image in Step 3 below. For example: you can add if (is_page($pageID_comments) || in_category($catID_comments)) echo('class="current"'); to the list tag so that when a user is on the comments page in the glossary or on one of the post pages for a post published in the comments category, the class “current” kicks in and is styled to a different color, or underlined, or both, etc.
  • The list of posts in all categories of the glossary

FYI: When adding items/posts to the glossary, you must add them to both the parent category and the specific child/sub category it belongs to. For example, you would add the Comment Karma post to the “comments” and the “timeless wordpress plugins glossary” categories when publishing this post. This way it will appear on the glossary landing page as well as the individual child/sub pages they belong to.

Step 3:

Step 3 requires creating a second template page for the five child/sub pages:

LoveAffair-MakingAGlossary

You can basically use the same page created for the landing page (glossary.php) and name it “glossary_alpha.php” with a template title “Glossary Alpha”, then make just two adjustments:

  • Add an if else statement to the page query that looks something like:


    if (is_page($pageID_posts)) {
    $currentid = $catID_posts;
    } elseif (is_page($pageID_comments)) {
    $currentid = $catID_comments;
    } elseif .... {
    }
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=$currentid&orderby=title&order=ASC&paged=$paged");

  • Add a link to the title of this page so it goes back to the glossary home/landing page

This way, the current page a user is on will call the relative posts associated with that page. “Comments” page will show posts from the “comments” category, the “Posts” page will show posts from the “posts” category, and so on.

Step 4:

Now, go back into you wp-admin. And for each of the five child/sub pages, set the page template to “Glossary Alpha” page you created in Step 3 and then set the “Timeless WordPress Plugins Glossary” parent page, page template to the “Glossary” page you created in Step 2.

Step 5:

Step 5 requires creating a second single.php page template. Basically I created a default single.php template called single_default.php which has the standard single.php code. Then, in the single.php file I add something like the following:

$post = $wp_query->post;
if ( //glossary single
in_category($glossaryparentID)) {
include(TEMPLATEPATH . '/single_glossary.php');
} else { // Default single
include(TEMPLATEPATH . '/single_default.php');
}

Then, using the single_default.php template as a base, I created the single_glossary.php template which will be used for each of the posts associated with the glossary categories you created in Step 1. Above the post title, add the title of the glossary at the top (linking it to the glossary home/landing page), followed by the glossary navigation. Here’s an example:

LoveAffair-MakingAGlossary3

Step 6:

Put a link somewhere on your site where people can get to the glossary home page. Start publishing posts!

There you have it. Your very own WordPress glossary without using a WordPress plugin.

See you next time on…Our Love Affair With WordPress.

back to top

Commenting

Comments begin below:

15 responses so far ↓

  • 1 Custom Essay // Apr 8, 2010 at 6:34 am

    Nice way! thanks for the briefing on it!

  • 2 Cutom Thesis // Apr 8, 2010 at 6:35 am

    I think it should be. Now it is very nice to know about it.

  • 3 Social Computing Experts » Making a Glossary Without a Plugin in Wordpress | The WordPress PAD // Apr 12, 2010 at 1:49 am

    [...] Follow this link: Making a Glossary Without a Plugin in WordPress | The WordPress PAD [...]

  • 4 Content Management System // Apr 23, 2010 at 8:43 am

    This is interesting informative blog post….
    Thank you for the post…

  • 5 Blackberry Apps // Jun 9, 2010 at 12:10 pm

    Great post….
    Thank you for the post…

  • 6 Web Graphic Design // Aug 22, 2010 at 1:24 pm

    I love wordpress because its very easy to use…
    Thank you for the post.

  • 7 Download msn Smileys // Sep 5, 2010 at 3:28 am

    Good its interesting

  • 8 Ruben Sargsyan // Oct 6, 2010 at 5:09 am

    You can also use the plugin “Explanatory Dictionary” for making a glossary.

  • 9 Chris Ota // Oct 7, 2010 at 12:21 pm

    I agree with Ruben, you can also use the dictionary plugin. WordPress is simple enough to use to install and use plugins. This might be useful for someone a bit more code savvy.
    Thanks for taking the time to write this up!

  • 10 recette yaourt // Jun 13, 2011 at 5:23 pm

    thanks for this share

  • 11 skill games // Sep 2, 2011 at 2:40 am

    Hi. What would the step 2 look if we used not a template page?
    Thanks.

  • 12 web page animation // Oct 31, 2011 at 11:30 am

    Wow! That Are really nice ideas. i think most Of people Aren’t Aware About this Kinds of techniques!! i really like the Way you Expressed!

  • 13 Jeremy Berger // Nov 14, 2011 at 8:32 pm

    To create a glossary Create a page This will be your glossary home page. For every letter of the alphabet or however you want to index create a category —-All Definition terms will be created with a post so all terms beginning with A will be linked to category A and all that begin with B are linked to Category B and so on once in that category you will see all the terms and you can click whatever you want. If you have the seo plugin copy your terms into deepjaugernut (or however it is spelled) and it will link all of the terms in your blog for you with one click.

  • 14 Renew Geotrust SSL // Nov 15, 2011 at 2:06 am

    I wonder how you got so good. This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your Blog is so perfect!

  • 15 Kashif // Feb 29, 2012 at 4:48 am

    Nice tutorial, i liked it

Leave a Comment

back to top