WP-SNAP! WordPress Plugin
What Is WP-SNAP!?
WP-SNAP! (WordPress System for Navigating Alphabetized Posts) creates an alphabetical listing of post titles on a Category or Page template file. Navigation through the listings WP-SNAP! generates is accomplished using the alphabet itself. (For example, if a site visitor clicked on the letter D, any post titles that began with that letter would be showcased.) WP-SNAP! will work on any Wordpress 2.1.x or higher site, but is particularly useful managing glossaries, indexes, reviews, or directories. Since it is said that a picture is worth a thousand words, here’s a screenshot of WP-SNAP! in action:

WP-SNAP! offers three different navigational styles and integration with both custom permalinks and the Wordpress loop. Plugin options can be managed both site-wide and on the template itself with results either restricted to one category or broadened to include child categories as well. The clever web developer should have no problem seamlessly integrating WP-SNAP! into their latest project. Options have also been added to allow the customization of css class names and the appearance of html mark-up.
How To Configure WP-SNAP!
- Click on the link to the right to download the WP-SNAP! WordPress Plugin, extract it and upload it to your WordPress Plugins folder on your site.
- Activate the Plugin from the WordPress Administration Plugins tab.
- Edit the category templates your Theme uses, such as category.php, and add the following code above the start of the Wordpress Loop:
<?php if (function_exists('wp_snap')) { echo wp_snap(); } ?> - Copy the CSS example below and paste it into your WordPress Theme stylesheet (you can style it better later).
- Upload the files and refresh the category page on your WordPress blog to see it in action.
- For further customization, go to the Plugins > WP-SNAP! panel and change the alphabetical structure to something different and click Update Options. You may also change the categories to be displayed and the menu navigational structure by passing variables as a query-string to the plugin like so:
<?php if (function_exists('wp_snap')) { echo wp_snap('arguments'); ?>There are currently four possible arguments: Category (’cat’), Include Category Children (’child’), Navigational Menu Style (’menu’), and First Load (’firstload’). Category must equal a category number from your WordPress installation, Include Category Children must equal true or false as to whether to include child categories (the default value is false), Navigational Menu Style must equal a number between 1 and 3 (corresponding with the three navigational styles offered in the admin options panel), and First Load must equal ALL, NONE or RECENT and will affect how WP-SNAP! displays posts/tags when it is first called on a template. Note that if RECENT is selected, the number of recent posts/tags to display can be controlled from the admin options page. For instance, to create a navigational menu for all posts in category 15, including child categories, using the default menu navigational style, and displaying recent posts on first load, WP-SNAP! would be called like this:
<?php if (function_exists('wp_snap')) { echo wp_snap('cat=15&child=true&firstload=recent'); } ?>To create a navigational menu for the current category, excluding child categories and using navigational menu style 3, WP-SNAP! would be called like this:
<?php if (function_exists('wp_snap')) { echo wp_snap('menu=3'); } ?>To create a navigational menu for all categories, using default navigational menu style, WP-SNAP! would be called like this:
<?php if (function_exists('wp_snap')) { echo wp_snap('cat=all'); } ?> - Test it out and enjoy!
Note: For the Plugin to work, you must have access to edit your WordPress Theme files. You must also have a category.php template file in your WordPress Theme. If you do not, you can create one following the instructions on the WordPress Codex for creating a category template file.
CSS Styling
It should be noted that this plugin does not inject any css styling information, so it is up to the user to add the appropriate class information to the Wordpress Theme css stylesheet. Here is some sample code to get you started:
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;
}
Feedback
This plugin thrives on user feedback. Praise, ideas, and bug reports are all welcome. Use the comment form below to let me know what you think. Please keep in mind that I am not paid to work on this plugin and that delays between updates can and will occur. Please do not post questions about when the next update will be released. I appreciate your enthusiasm, but your comment will be deleted. If there is a significant delay between releases, I try to post a timeframe of when the next update can be expected.
Thank You
My thanks to Lorelle VanFossen for reviewing my plugin and allowing me to reuse her instructions on this page.
Change Log
- 06.2008.10 Version 0.8.5
- Added international language file support
- Changed the method for passing data to the plugin
- Tracked down bugs
- 06.2008.08 Version 0.8.4
- Made the plugin compatible with Wordpress’s new tagging system
- Corrected problem with listing recent posts
- 04.2008.03 Version 0.8.3
- Fixed a small — but significant — typo
- Moved the administrative submenu to plugins.php
- Added the ability to display All/None/Recent posts on first load
- 12.2007.02 Version 0.8.1
- Fixed incompatibility with PHP 4
- 11.2007.28 Version 0.8
- Added support for fancy URLs
- 10.2007.04 Version 0.7.3
- Fixed error with Wordpress 2.3 database call
- 09.2007.28 Version 0.7.2
- Made database call compatible with Wordpress 2.3
- 06.2007.02 Version 0.7.1
- Fixed error with database call
- 05.2007.30 Version 0.7
- Fixed issue preventing the display of more than 10 posts
- Fixed issue with sorting uppercase/lowercase post titles
- Restored ability to pass a category to the plugin
- Added ability to include category children in returned results
- Added ability to display all categories
- Added ability to change navigation style when calling the plugin
- Added support for Gengo (hopefully)
- 05.2007.12 Version 0.6.2
- Restored the ability to exclude first words from being alphabetized
- Cleaned-up some instructional text in the options menu
- 01.2007.21 Version 0.6.1
- Fixed a minor error with the $wp_snap_category variable
- 01.2007.20 Version 0.6
- Rebuilt the entire plugin to be better, stronger, faster
- Changed how results are displayed; plugin now plays well with the Wordpress loop
- Removed option to pass a category number directly to the plugin, making it incompatible with Pages (feature to return if requested)
- Added nonce protection to the admin options panel
- Added option to group posts beginning with a number under ‘#’
- Fixed unencoded ampersands
- 09.2006.20 Version 0.5.4
- Updated WP-SNAP! to ignore posts with post-dated timestamps
- 08.2006.02 Version 0.5.3
- Fixed an error that affected certain navigational menu styles
- 08.2006.01 Version 0.5.2
- Updated alphabetization to accomodate accent marks; still needs refinement
- Fixed a logic error with the post title sort loop
- 06.2006.07 Version 0.5.1
- Squashed some bugs in the new ignore filter
- 06.2006.06 Version 0.5
- Words can now be filtered from the alphabetization process from the WP-SNAP! admin options menu
- 06.2006.01 Version 0.4
- Added ‘#’ to catch category entries beginning with non-alphanumeric characters
- Tweaked the code here and there
- Fixed the WP-SNAP! plugin url on the admin options page
- 05.2006.13 Version 0.3.1
- Fixed the url structure of the navigation when used on a Page
- Added ‘apply_filters’ to the post excerpt
- 05.2006.08 Version 0.3
- Plugin no longer displays excerpts for password protected posts, if the viewer is unauthorized
- If there is no excerpt for a post and excerpts are turned on, plugin now creates an excerpt from the post content
- Fixed a typo
- 03.2006.29 Version 0.2
- Added the ability to pass a category number directly to the plugin, making WP-SNAP compatible with Pages
- 03.2006.29 Version 0.1
- Initial Release
Comments
Download The Latest Release
View The Code
Make A Donation
If you find this plugin useful, please consider making a donation. It's a great way to say “thank you” for all the hard work that has gone into its development.
Frequently Asked Questions
-
When will the next version of your plugin be released?
As soon as I find the time, I will update the plugin and release a new version. I understand how frustrating it can be to be so close to having the perfect Wordpress installation only to be held up by a plugin that just needs a little more work to be exactly what’s needed. However, please remember that I am not paid write this plugin and that, like you, I have a family and responsibilities that extend far beyond this little piece of code. I really appreciate your enthusiasm, but if you wish to reap the benefits of my freely given labor, then you must be satisfied with doing so on my timetable. Otherwise, if you simply cannot wait, you are more than welcome to modify and extend the capabilities of my plugin yourself.
-
Why do the results WP-SNAP! returns look funky? Why is it numbering every item?
A web page is composed of two parts: a document containing HTML code and a document containing styling code (known as a Cascading Style Sheet, or CSS for short). Because WordPress templates can look so drastically different from one another, I have intentionally avoided injecting any CSS information into WP-SNAP! However, I have included several ID selectors (that can even be modified from within wp-admin) that should allow you to style WP-SNAP! to look however you’d like. Those numbered lists? You can turn them off. I do ask that you try to refrain from asking me CSS related questions — while I would love to help you, my time is limited. If you would like to learn more about CSS, I suggest visiting A List Apart or Vitamin.
-
I tried using your plugin, but it just won’t work. What am I doing wrong?
Unfortunately, I don’t have the time to troubleshoot every installation of this plugin. However, if you believe you have discovered a bug, I encourage you to post a comment to my website and I will reply as soon as I can. I do request that you be as specific as possible when asking for assistance. Please provide a detailed account of the steps you took that resulted in the error you encountered so that I can try to reproduce it and more quickly deduce how to fix it.
Thanks for the great plugin! WP-SNAP! always seem to work fine with me, until today. When I was watching my CD category I saw that only the ‘front page’ of the category is working, when you click on a letter I get the 404 page of my website. You can view it over here: http://www.blastbeat.nl/category/recensies/ I hope you can help me out with this because I can’t find a solution and I really like to use the WP-SNAP! plugin. Thanks in advance,
Michael
September 15th, 2008 at 11:29 pm
Michael — My guess is that you have another plugin running that is controlling your permalinks and preventing WP-SNAP! from functioning correctly.
September 16th, 2008 at 4:20 pm
how can i change the fancy url to show small letters? and i prefer to show 0-9 instead of #.. how can i do it?
September 17th, 2008 at 9:32 pm
od3n — You need to change your CSS stylesheet.
September 18th, 2008 at 12:08 pm
i mean the permalink. the default will be something like browse-A. so i want to change so it will be like browse-a. another thing, which part of css u mean to? i want to change # to 0-9. thanks!
September 18th, 2008 at 2:32 pm
od3n — I have provided three different display options in the plugin. If none of them suit your needs, you will need to change the plugin code.
Changing the permalink to lowercase letters would also require altering the plugin itself.
Unfortunately, I’m afraid that I do not have the time to walk you through how to do this.
September 18th, 2008 at 3:15 pm
It was the Permalink Redirect plugin. I deactivated it and WP-SNAP! works fina again now. Thanks!
September 19th, 2008 at 3:50 am
Thank you, nice plugin.
September 26th, 2008 at 3:15 pm
Hi, Nathan
Thanks for the plugin!
I can not read all the comments and the search way don’t give me a clear solution. I have created the category and I would like to create a page to show the index. The page is also created. So, my question is how can I show the index in the page?? I have read this (http://blog.grapii.com/index.php/2008/02/29/create-a-glossary-with-wordpress/) but I don’t see it :-(
October 12th, 2008 at 5:35 pm
maria — I do not have time to review the tutorial to which you refer. The instructions for installing this plugin are the same for a Post or a Page and those instructions are listed above. Please be more specific if you need assistance. Thanks!
October 12th, 2008 at 10:28 pm
Nate, thank you for this great plugin!
I have a question (a feature request, really). Is it possible to create navigation menu for several categories using the ‘cat=’ argument? It would be awesome to be able to specify categories you want (like ‘cat=3,5′, for example), not just one category or all categories.
I’m asking about it because there is a real use case for this feature — if a person has some categories that should be using WP-SNAP for navigation (for example, reviews), and some that shouldn’t (for example, personal blog), specifying categories for wp_snap function would be awesome!
PS. I also agree with many people who posted here asking for page navigation. It would be really awesome because once your post archive grows beyond certain limit, getting all posts for a certain letter at once might be pretty hard and isn’t really necessary (it’ll cause information overload).
October 16th, 2008 at 9:36 am
KAy —
Is there a severe disadvantage to putting all the categories that you want to use with WP-SNAP! under one parent category? Because the plugin already allows you to display a category and any children.
Yes, pagination will happen one of these days. If it were just a few lines of code, it would be done. But it’s a big project, unfortunately.
October 16th, 2008 at 10:41 am
This plugin is really great. Thanks for this.
October 16th, 2008 at 2:12 pm
Well, look at it this way: say, I have a separate categories for movie reviews and for music reviews. Obviously, they should not have a child-parent relationship (besides, I might have subcategories for both these categories), so I have to display them both. At the same time I have a category for personal blog entries which should not be alphabetized.
So, on my “browse my reviews” page I cannot specify “all” since I don’t want to include personal blog stuff (it’s logical since it isn’t reviews), and I cannot specify only one category (it’s logical since they’re both reviews and they’re both should be alphabetized).
I’m pretty sure this use-case is not the only one, but this one is definitely real.
October 17th, 2008 at 8:06 am
Most excellent plugin, I do however have a request/problem.
Some of my categories will have 100+ results under some letters and 2-3 under others.
Is there a way to implement pagination so that my categories with 100+ pages will only display 20 results per page?
infinite post excerpts per page isn’t an option.
Thanks in advance
November 1st, 2008 at 7:58 pm
PopularWealth — Yes, it is possible to implement pagination. But it is not easy and I haven’t had the time to work it out. It is high on the todo list, however.
KAy — In the example you gave, it seems to me that both “movies” and “music” categories could be put under a parent “review” category and thereby make it possible to list them together using WP-SNAP! However, it’s not for me to tell you how you should use the plugin and, you’re right, one should be able to call more than one category. I’ll look into it when I can.
November 2nd, 2008 at 12:55 pm
I with Kay on this… My site I need to list Venues based on same principle as Kay mentioned. I need my personal blogs separate.
November 11th, 2008 at 11:22 am
in the template file, unable to access
if (in_category(’782′)) function for each item in loop - returns false instead of true
November 15th, 2008 at 9:19 am
Adrian — I’m not sure what you’re expecting to happen, but your comment doesn’t really contain enough information for me to respond to it. I can make guesses as to what your problem is by inferring information from your comment, but it would be nice if you could be a bit more explicit as to what you did and what didn’t work the way you expected.
November 15th, 2008 at 1:22 pm
This looks to a great plugin and would be perfect for my site, but it does not work.
I am running WordPress 2.6.2.
I added the below to the category.php file.
I am getting this error.
Error message:
If I use cat=all it gives me a timeout, that may be do to having 46,000 posts and one of the categories has over 8,000 posts in it.
Any ideas on how to get it to work?
Thanks,
Chuck
November 17th, 2008 at 10:29 am
Pages: « 1 … 14 15 16 [17] 18 » Show All
Leave a Reply