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.
Only problem I noticed is if the fancy url name contains any of the same letters in succession as the category, the url gets truncated and is 404. Seems to work smoothly otherwise.
December 5th, 2007 at 4:03 pm
I think that a paging system would be great too. Currently I have a DVD review site, which I was using the plug-in for, but the number of reviews have grown exponentially and now I have the same problem with too many posts for one page to load correctly.
December 18th, 2007 at 1:19 pm
I love this handy tool! (Great job!!!)
Question: Is it possible to create a separate page with the listings instead of it linking directly to each category?
Example: I create a separate “page” for “Articles Index” where your plugin call for all content/articles in each category.
[For my site, I’d rather people click a separate page where they’ll find an alphabetical directory of all posts - sort of like the “archives” but alphabetically and not by date.
Thanks and HAPPY HOLIDYAS!
December 23rd, 2007 at 10:26 pm
I agree — What a great plugin! Two suggestions, though, one of which I just pulled an all-niter sussing out…
Automatically alphabetize all posts by last name / 2nd word (see solution below)
*Not* split category into 2 or more pages (This I still need assistance with)
Here’s my hack solution to #1 above, moving $exclude[1] and $exclude[2] down in the code in order to redefine $exclude[0] from a query loop….
$all_posts = $wpdb->get_results($request);// CREATE REPLACEMENT FOR get_option('key_snap_exclude') ON THE FLY
// ALPHABETIZE ALL LISTINGS BY 2ND WORD (LAST NAME)
$Checkit = '';
for ($i=0; $i post_title);
$Checkit .= $post_title_array[$i][0];
if(($i+1)post_title));
}
It sure ain’t pretty, but meets my needs for saving time on adding to “Ignore During Alphabetizing” each time a new name is added. (See it in action here)
Any chance of a “Christmas Miracle” for #2?
Either way, thanks for all your work on this!!
December 24th, 2007 at 6:39 am
Kaitlyn — Yes, you can have the results appear on a Page. Just call the plugin with a category number, as explained in the instructions above, on a Page template.
Zoinks! — Since everyone has been asking for it, I will be making a paging system for the plugin. It isn’t a trivial task — looking at other plugins with paging functions, it’s pretty complicated. I haven’t looked into why it’s so complicated, just that all of the solutions I’ve looked at use a lot of code.
Thanks for sharing your code, perhaps someone else will find it useful. It sounds me like what you’d like to see is an “Ignore the first __ words during alphabetization” option. I’ll keep that in mind.
December 24th, 2007 at 10:56 am
Hi Nathan and all people here.
This is very helpfull plugin. Thank you very much.
I went through all comments and one guy mentioned about same feature which I’m thinking so I quote it here:
“Is there a way to not have the plugin list titles on first load? I only want the titles to list when the user has clicked on a letter. Currently when the page first loads it lists titles beginning with the letter “Aâ€.”
I wish I could see thise feature.
But more interesting (and this is the best for me) is there a way to have on “first load” list of recent articles from particular category? Then when I click on particular letter I’ll get alphabetical list of articles.
Summarize:
- on first load - recent articles
- on letter click - alphabetical list of articles
Thank you in advance.
January 1st, 2008 at 6:14 pm
Hi, just to say this is a great plugin. I’d like to add my vote to what Absolon has suggested about having the ‘first load’ list recent articles from category ‘x’ and then when you click a particular letter you get the alphabetical list. That’d be very cool, and mean I could implement it more widely on the website I’m currently building.
Thanks alot for all your hard work!
January 3rd, 2008 at 11:05 am
I agree with the above two commenter’s, this is a big must have I feel.
January 4th, 2008 at 12:21 pm
For those that wanted a paging system, I just got this to work with another website of mine that does not use wp-snap. It uses a home grown MYSQL database application. What I am going to try to do is get this to work inside wp-snap for wordpress now.
It will take a little while, but hopefully it works. I will document what I do and let everyone who wants to know how when it is complete.
Nathan, or anyone else for that matter, please let us know if this is something you are actively working on, so people don’t waste time on this.
Thanks. :)
-Marc
January 27th, 2008 at 1:59 pm
Marc — I have not done any work on a paging system at this time. If you wish to tackle that problem and develop a paging system for WP-SNAP!, you are welcome to. If your solution works well, I would be happy to integrate it into the plugin and give you credit for the code. That’s what open source software is all about, right?
If you’ll notice, this plugin has been in development since March of 2006. Strangely, it has only been in the last few months that anyone has expressed interest in a paging system. It obviously needs to happen — and I’ll get to it eventually — but I work on this plugin when I have breaks in my schedule, which hasn’t happened recently.
FYI — Next on my list of things to do is to add the ability to initially show either All/None/Recent posts when the plugin first loads. After that, I plan to tackle the paging system. Again, if someone wishes to speed up the process and develop the code for these features themselves, more power to you. I look forward to your results!
January 27th, 2008 at 5:37 pm
Nathan,
Not as easy as I hoped it would be, well at least after first look. I will keep hacking at it but who knows.
I am also writing to let you know I made a donation… Keep up the good work.
-Marc
January 28th, 2008 at 11:52 am
This plugin prevents other ways of searching categories and does not work on a static page. If I have the category links listed and some one clicks on it, it automatically goes to the “a” titled posts. If I deactivate the plugin it works correctly
February 5th, 2008 at 7:38 pm
Samura — You’ve packed a lot of information into two short sentences. I’m not even sure I understand what the issue is that you are encountering. More information would be lovely. Thanks.
February 6th, 2008 at 4:28 pm
Sorry for the mouth full…lol.
Ok I have a static page enabled and when you click on one of the letters it does nothing.
If your on a post page or category page and click on a link it only goes to all post starting with the letter “a”.
If I disable the static page then the plugin works correctly.
February 8th, 2008 at 9:27 pm
Oh yeah and if you use the wp_list_category tag along with the plugin the links displayed for the categories do not work
February 8th, 2008 at 9:29 pm
Samara — Thank you for the additional information. I just tested WP-SNAP! again on a Page and it loaded fine. I tried not loading any category, specifying one particular category and loading all categories — the plugin worked like a charm. Perhaps you are encountering a conflict with another plugin or a particular Template Tag?
With regards to the issue with wp_list_categories, I can confirm that this is a problem. I don’t have a solution yet. I’ll look into it.
February 13th, 2008 at 11:24 pm
So it doesn’t give you any issues when using a “static” page?
February 14th, 2008 at 1:08 pm
Samara — If you are referring to a Static Front Page, then no, the plugin will not work on that. WP-SNAP! depends on the Wordpress Loop and the Loop does not work on a Static Front Page. Hence, it’s “static.”
February 14th, 2008 at 4:19 pm
Ok. When I have the static page enabled even if I use the code on the categories page only it still doesn’t work. Thanks anyway. It’s a great plugin it just doesn’t work for what I’m trying to accomplish.
February 14th, 2008 at 8:47 pm
Is there a hook for the letter group currently displayed? I’d like to display it in addition to the complete alphabet list.
February 18th, 2008 at 2:16 pm
Pages: « 1 … 11 12 [13] 14 15 … 18 » Show All
Leave a Reply