How To SetUp A Glossary Of Terms In WordPress

If you have a network of blogs that cover a wide list of topics then each of such blogs have a lot of terms that are commonly part of your posts.For example you have a automobile blog and there are different terms like the engine type, torque, power etc., which might be difficult to interpret or understand for a novice or a casual reader.

wordpress glossary

In this post I setup the show how to setup a index of all the terms that can be a part of a glossary of terms for your blog/niche.To setup your own glossary follow these steps

  1. Create a new Category and keep a note of the category id of the new category.
    edit glossary category
  2. Next create a new file in your theme folder with the following name category-2250.php where 2250 should be replace with the category id from the first step.This makes sure that the category whose ID number is 2250 would look different from the pages of other categories.
  3. Now Download and Activate a plugin called “WP-Snap” which would help alphabetically sort the posts.You can further configure the WP-Snap plugin after activating under “Plugins->WP-Snap
  4. The contents of the category-2250.php should be like your archive.php with this small code added before the WP loop.
    <??php if (function_exists('wp_snap')) { echo wp_snap(2250, FALSE); } ??>

    where 2250 is again the category id and don’t forget to replace the <?? with <? and ??> with ?> if you copy the above code.

  5. Next add the following CSS to your theme style.css
    
    ol.snap_nav {
    	display: inline;
    	float: left;
    	clear: both;
    	list-style: none;
    }
    
    ol.snap_nav li {
    	display: block;
    	float: left;
    	padding: 0 2px 10px 0;
    }
    
    ol.snap_nav li a {
    	font-weight: bold
    }
    
    ol.snap_nav li.snap_selected a {
    	cursor: text;
    }
    
    ol.snap_titles {
    	clear: both;
    	display: block;
    	border: 0;
    	list-style: none;
    }
  6. Next to exclude the glossary updated from RSS and Index Page, add the following code to your themes functions.php file
    function myFilter($query) {
    	if ($query->is_feed || $query->is_home) {
    		$query->set('cat','-2250');
    	}
    
    return $query;
    }
    
    add_filter('pre_get_posts','myFilter');
  7. Adding terms to the glossary is similar to adding a new post, the only important thing to remember is to add the post as part of the category create and not as part of any other category.
  8. After that try accessing the category page you just created and you should be able to find the glossary.

Advan

Now add a link to the the category and you should be able to browse your glossary.

Using the above method you can create any number of glossary on a single blog.

[ Via – Grapii ]

Similar Post  Manage Code Snippets Easily Using Snippely Adobe Air Application

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.