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.
Awesome plugin. Not much else to say but thanks.
September 12th, 2007 at 3:31 pm
Like a few people have mentioned in previous posts, I too would like the option to show all (or no) posts on the category page that wp-snap is used on. On the main category page I want to have a listing of album reviews using several custom queries, and then use wp-snap to jump to pages devoted to each letter of the alphabet, with a graphic depicting the letter currently selected.
Here is the static page format I am trying to duplicate with wordpress and wp-snap:
http://www.pensatos.com/reviews/index.html
I am relatively comfortable with editing php, but I am not sure how to go about solving this problem. Any ideas would be much appreciated. I can explain in more detail if need be. I think this might be the last step to making wp-snap complete feature wise.
September 16th, 2007 at 9:05 pm
Hmm. I’m guessing that since it’s from June, and relies on the post2cat table (which is no more), WP-SNAP v0.7.1 isn’t Wordpress 2.3 compatible. Are there plans to make it so?
September 28th, 2007 at 11:04 am
Sigh. I just downloaded 2.3 the other night and poked around a bit, but I hadn’t had a chance to test out the plugin. Yes, you are correct, WP-SNAP! is not 2.3 compatible. I just took a look at the database changes to see if I could quickly post an update, but first it looks like I’m going to have to spend some time wrapping my puny little brain around the new database structure and see if I can’t take advantage of the new API instead (and prevent future breaks).
Hrm. I’ll find the time. Thank you for the heads up!
September 28th, 2007 at 11:25 am
I’ve updated WP-SNAP! to play nicely with Wordpress 2.3. The plugin should also still be compatible with older versions of Wordpress. No other changes or enhancements were made.
Because Wordpress now uses a tagging system instead of a category system, I will probably need to rewrite the database call to allow WP-SNAP! to work with tags as well as categories. For now, the plugin works as it did before.
September 29th, 2007 at 12:02 am
Hello Nathan,
I installed your plugin on a recently updated to Wordpress 2.3 website. I made a category template (copied the basic category.php) and placed this in the file above the loop :
when I click the category I get this error :
WordPress database error: [Table 'website_admin.wp_categories' doesn't exist]
SELECT wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) LEFT JOIN wp_categories ON (wp_post2cat.category_id = wp_categories.cat_ID) WHERE 1=1 AND wp_term_taxonomy.taxonomy = ‘category’ AND wp_term_taxonomy.term_id IN (17) AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_author = 1 AND post_status = ‘private’)) GROUP BY wp_posts.ID ORDER BY post_date DESC
Warning: natcasesort() [function.natcasesort]: The argument should be an array in /home/website/public_html/wp-content/plugins/wp-snap.php on line 273
Warning: array_values() [function.array-values]: The argument should be an array in /home/website/public_html/wp-content/plugins/wp-snap.php on line 274
Warning: Invalid argument supplied for foreach() in /home/website/public_html/wp-content/plugins/wp-snap.php on line 276
Warning: natsort() [function.natsort]: The argument should be an array in /home/website/public_html/wp-content/plugins/wp-snap.php on line 287
Warning: array_values() [function.array-values]: The argument should be an array in /home/website/public_html/wp-content/plugins/wp-snap.php on line 288
any tips on what may be causing this? thanks!
September 29th, 2007 at 5:49 pm
Mike — I responded to your post via email, but I haven’t heard anything back. I am assuming that I was correct and the problem was that you had no posts in the category which you experienced the issue. If that is not the problem, or if someone else experiences a problem like this, I would appreciate it if you would leave a comment and provide as much info about the problem as you can. Thanks!
October 1st, 2007 at 9:11 am
Hey Nathan,
Sorry I haven’t checked my email but I did just send you a reply. I do have posts in the category where I tried to apply wp-snap 0.7.2 and wordpress 2.3. Any other tips? thanks,
Mike
October 1st, 2007 at 3:10 pm
Mike — Thank you for the feedback. I found the problem and I think I fixed it. Please let me know if you run into any other errors. Sorry for the delay!
October 4th, 2007 at 5:49 pm
Hello Nathan,
Thanks! 0.7.3 works like a champ on wordpress 2.3. Mucho gracias. I have one more question. When using wp-snap on a page to list posts in a certain category, how do you get it to list just the title only or list post honoring the more tag? It seems to display the whole article post for each of the posts under the alphabet selected..which comes out to be a long page. thanks again…
October 5th, 2007 at 12:20 am
To get only post titles to display, you need to edit your Wordpress Loop. There is currently no paging option.
October 5th, 2007 at 8:26 am
Hey Nathan,
Thanks for the answer. I do remember that in the 0.5.X series for wp-snap there was an option to list just post titles on a page …without editing the loop itself (and changing the layout for the whole blog). This was removed in the 0.7.x series?
October 7th, 2007 at 8:48 am
Yes, that functionality was removed to allow the user greater page layout flexibility. But you can solve your problem by creating a Page Template.
October 7th, 2007 at 1:37 pm
Hi, I am using your plugin … what happens is that it returns all posts in a category - not just posts that start with that letter. So if I hit ‘T’ it should return a post entitled ‘Tommy Nevins’ but it also returns ‘Bar Louie’. Is that normal?
October 18th, 2007 at 1:35 pm
Chris — You must call WP-SNAP! before the Wordpress Loop.
October 18th, 2007 at 5:46 pm
Hi Nathan. This plugin very nice. How i make alphabetical index for main categories ? ( not in child category ). Thank you
October 22nd, 2007 at 5:13 am
Astar — Since your question is so general, I don’t see why I should repeat myself. Just follow the directions under “How to Configure WP-SNAP!” above.
October 22nd, 2007 at 7:25 am
Nathan,
You have exactly what I need. I can’t figure out how to set it up. Could you send me something more specific. I am using 2.3.
I would be happy with a new page with just a to z listings, but in the sidebar of every page would work as well.
thanks
Wendy
November 4th, 2007 at 10:46 am
Wendy — Your request for help is very vague. The directions I have listed on this page are as specific as I know how to write them. If you have a more specific question, please feel free to ask. However, keep in mind that I do not have the time to teach you php, html or how Wordpress works. If you are having a problem understanding how edit the Wordpress files, you might need to do further reading on your own on how to edit a Wordpress Template.
November 4th, 2007 at 4:09 pm
Hello Nathan,
I’m using 0.7.3 in specific category templates to have alphabetical listings of posts. Problem is when a user clicks on the article there are no navigational links (for the theme im using). So I tried adding 0.7.3 in a single.php and unfortunately it does not work. It lists everything.
Perhaps in a future release would it be possible to have an option to place in a single.php with a specific call, so that the alhpabetical navigation bar shows but doesn’t list any articles? Then once the user finishes reading the article they can click an alphabet to get a listing of all articles under a specific letter?
November 8th, 2007 at 12:52 am
Pages: « 1 … 9 10 [11] 12 13 … 18 » Show All
Leave a Reply