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.
Hi Nathan,
Thank you very much for such a great plugin! It does almost everything I was hoping for!
The only problem I have is how this plugin deals with other special characters. Some titles of my posts start with Chinese characters and they get sorted kind of randomly. It’s probably not easy to really sort them but I wonder whether it’s easy to at least put them into a separate category (like under #). I did some test and I found out the Chinese characters are “translated” into some letters and they are sorted according to these letters. For example, “七” becomes “且 and is under A, “色” becomes “色”€ and is under E. Is it possible to have a simple option to only sort 123ABC etc and put all the others that start with ä, è etc to a separate category? ‰
Thanks!
March 26th, 2008 at 3:27 pm
fp —
As you already know, right now there is no support for international characters. This will be remedied eventually. Thanks for the heads up!
March 31st, 2008 at 9:15 pm
Hi Everyone — As you can see, I released a new version of the plugin a couple of days ago. I forgot to update the information in the readme, but documentation of the new feature I introduced can now be found on this page. I have added the ability to have WP-SNAP! display all, none or recent posts when it firsts loads (ie, no letter is selected). Instructions are above. If it’s unclear, let me know.
April 4th, 2008 at 5:56 pm
I just played with this on my tag.php template, and apparently the plugin doesn’t work well with tags in wordpress 2.5.
I guess it’s in charge of queries made on /tag/XXX pages of wordpress, and therefore it doesn’t display the entries tagged with a certain tag, but it resorts to either ALL, NONE or RECENT.
Any way you can fix that, so that it closes the loop somehow or works just fine with tags…?
April 7th, 2008 at 3:13 pm
James — You’re right, I’ve never given any consideration to tags. That should be fixed. It will be (eventually). Thanks for the suggestion!
April 7th, 2008 at 4:15 pm
hi nathan
this plugin is very cool… i do have some questions and would appreciate your help.
i have a list of restaurants all categorized by the type of food (asian, italian, etc). I can get the plugin to work so that when i click on italian, the a-z list comes up and you can click on the italian restaurants…. what i was hoping to was actually put your plug in on a page (the reviews page) and have a A-Z box similar to the one at the top of your page where the user can click B and have ALL the restaurants with a B pop up in alphabetical order… not just the ones in a specifc category….
hope that is a specific enough request… again i appreciate any help you can offer
April 11th, 2008 at 1:14 pm
seattlefoodster — It depends on your site structure. If you want your restaurants to show up at http://www.yoursite.com/reviews, then you should set-up a Page template for that and call WP-SNAP! on it. If it’s http://www.yoursite.com/category/reviews/, then set-up a category template for it (and make the food styles (italian, japanese, etc.) child categories of Reviews). Or just set it up on your index page, if that’s what you want. The plugin will work in any of those places.
April 11th, 2008 at 3:27 pm
I’ve finally gotten the plugin working — thank you, Nathan, for the ALL option! — and I thought I’d drop by and offer the solution to the problems I had.
I had the A-Z index appearing on my home page as well as my category pages. However, clicking the links from the home page took me right back to the home page, without filtering the posts by letter. I finally realized that my custom theme’s home page template wasn’t using a normal loop; it used some specific queries to get a few certain posts.
The plugin will work beautifully on your home page IF you have a regular loop.
May 1st, 2008 at 6:34 pm
I’ve been using wp-snap happily for many months. Today I upgraded from WP v2.3.3 to v2.5.1
Before doing so on my main site I did it on a development replica site. wp-snap seems to work there so I proceeded to do the same on the main site and what had worked moments earlier now does not. The rest of the site works, but not the page set to use wp=snap.
Any experience like this before? I’ve disabled & re-enabled the plugin, no luck.
May 2nd, 2008 at 10:14 am
Stephanie — Thanks for the feedback. I’m glad the plugin is working well for you.
Charles — WP-SNAP! does work with 2.5.1, so I don’t know what the issue is. It doesn’t yet work yet with tags, but it doesn’t sound like you’re using it that way. The best advice I can give is: Turn off all of your plugins, see if that works. If it does, turn them on one by and see what breaks things. If that doesn’t help, try rewriting your Wordpress Loop and see if a simple loop works. Again, if it does, then check your code for a problem. Good luck.
May 2nd, 2008 at 10:24 am
Hi, Nate. I hate to pester you, but I think I’ve found a bug. When I call WP-SNAP with recent posts showing on first load, clicking a letter just reloads the recent posts.
Here’s my index.php call:
if (function_exists('wp_snap')) { echo wp_snap(ALL, TRUE, '', RECENT); }and my category.php:
if (function_exists('wp_snap')) { echo wp_snap('', TRUE, '', RECENT); }The recent posts persist on both of those pages. I’ve tried it with my custom theme and the WordPress default, and the same thing happens in both. I also tried changing the other options — category shown, child categories — but it still just shows the recent posts. If I call it with all the default options (
echo wp_snap();) or with ALL on first load, it works perfectly in both themes.Permalinks are off for the blog, and WP-SNAP isn’t using pretty URLs.
If there’s any more info I can provide, let me know.
May 4th, 2008 at 9:01 pm
This is an excellent plug-in - huge thanks.
Is there any way I can get the results displayed on a different page, i.e. I would like to be able to display the navigation on my home page but want the list of results to appear on seperate page?
May 9th, 2008 at 3:25 pm
Stephanie — Thanks for the report, I’ll look into it. I’ve got another busy week ahead of me, so it may be a few days.
Ryan — No, there isn’t.
May 11th, 2008 at 4:20 pm
Hi! Thanks for the cool plugin. It actually works quite well but I got some problems with the fancy url feature. I don’t know what’s wrong here.. is it possible that the fact that my blog is in a subfolder screws up the permalinks? Maybe you can take a look, would be cool. Thanks!
May 22nd, 2008 at 4:04 pm
You might have already addressed this problem but there are so many comments I couldn’t find it. I’m using WP and trying to have this plug-in work on just a separate page I made where users can search and on the search results page. How can I do this? I tried pasting the in the html on the page I made, but it doesn’t work.
May 26th, 2008 at 1:53 pm
Cool :D
Thnx a lot bro …
I’ll try tonight :D
Keep good job
May 28th, 2008 at 9:11 am
Hi Nathan ..
I want to make Lyrics CMS with WP and your plugin .. :)
Btw how to make indexing the first letter category not post title .. so the hierarchy maybe like this …
WP Snap > A, B , C, etc …
ex..
A > Artist Name (From category) > Content Lyrics (From Post content )
Hehehhe .. maybe you can show me how to change your plugin to read first letter of cats .. :p
i hope my question is clear enough :D
Coz my english not to good ..
Thnx :)
Cheers . ..
May 30th, 2008 at 8:45 am
Why does your plug-in divide the posts into a-m and n-z. I find this a very, very inconvenient form of alphabetization. How can I stop this division. Maybe I’m dumb, but I can’t find a way.
May 30th, 2008 at 9:24 am
Andy — It sounds like you are saying that your Wordpress installation is not in the root folder of your site, but in a subfolder. Is that correct? Off the top of my head, I can’t see why that would be a problem. I wrote (okay, mostly stole) the code for fancy urls so that the plugin first captures the current URL and then appends the fancy url to the end. So, in theory, it shouldn’t matter. But I’ll add it to the list of things I need to check on.
Paul — I hadn’t thought of using the plugin on a search results page. Frankly, I’m not sure how it would. Are you foreseeing a search result that would pull up enough blog entries to warrant breaking them down alphabetically? Or would WP-SNAP! be used as an alternate way to search?
Ghprod — I’m glad to hear that you like the plugin. Unfortunately, it’s not really designed to alphabetized categories. It’s a feature that’s been asked for before (not frequently), but I can’t imagine why one would have so many categories to begin with that they need to be alphabetized. I am going to work on making the plugin compatible with tags, as that makes some sense. Maybe once that’s finished, you’ll be able to use tags to achieve the site structure you need.
Tom Mix — Well, considering the plugin does not default to the structure you’ve mentioned, it sounds like you’ve already changed the plugin’s options to display posts that way. Now you just need to undo it. :) There are two ways. The first is to change WP-SNAP!’s site-wide options through the administration options. If that is already configured, the problem may be in the options you are passing when you call WP-SNAP! on your Wordpress template. Read the directions above for further information on how this works.
May 30th, 2008 at 12:44 pm
Thnx 4 reply Nathan :D
i’m waiting for your future of this plugin (indexing tag :p)
Cheers …
May 31st, 2008 at 11:39 am
Pages: « 1 … 13 14 [15] 16 17 … 18 » Show All
Leave a Reply