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
- 02.2009.20 Version 0.8.6
- Fixed bug with posts beginning with misc. letters on sites not using fancy URLs
- Fixed bug with adminstrative menu
- 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.
I’ve just dowload the plugin, but I don’t find the option to exclude the first word from alphabetizing. Can you help me?
June 28th, 2009 at 6:06 am
Modesty — You would need to alter the plugin code to do that.
Taeke — I have absolutely no idea. My plate is full right now.
Maurizio — It’s on the plugin’s administration page in the Wordpress control panel.
June 29th, 2009 at 2:53 pm
Thank you, but I need to automatically alphabetize all posts by 2nd word. What can I do?
tnx
June 30th, 2009 at 5:23 am
I am trying to have the first page show all the posts grouped by their letters. Then when you click a letter, it will go to that section. How can I do this? or At least show all the posts on first page with their letter group?
June 30th, 2009 at 9:11 am
Thanks for the work on this plugin. I’m having a very general problem though: nothing shows up when I include the code before the loop. I’ve tried a few different themes, disabled all other plugins – still no luck. I’m using 2.7.1, can you think of anything that would cause this to happen?
July 17th, 2009 at 5:49 pm
Hy I Installed your plugin on http://logitune.fm
and it allmost works (it displays where it should, i have links on the letters that have posts starting with that letter) but when i click on a letter it snaps to the top of the page… not to that letter
any sugestions?
July 27th, 2009 at 8:18 am
Hi,
I’m using sub cateogries and I’d like the plugin to display the subcateories when the main category is visited is this possible.
Regards
Colin
July 29th, 2009 at 2:59 am
Should this plugin be compatible with WP 2.8.2? I am getting array errors and other problems when trying to run it under 2.8.2: Warning: natcasesort() expects parameter 1 to be array, null given in …\plugins\wp-snap\wp-snap.php on line 358
July 30th, 2009 at 5:21 am
Very great plugin thank you ! But i have some problems with it. In the alphabetical list it put only some posts represent 20 % of all my posts … I dont understand why … I use WP version 2.7.1 if that can help you.
July 30th, 2009 at 8:42 am
maurizio, TMW & Bogdan — I don’t have an answer for you. If you need that functionality, you will need to research your own solution.
YMO — Try it on a new, unmodified version of Wordpress and see if you get the same result. If you do, then you are doing something wrong because should be working. If it works, then the problem lies with something else you are doing.
Logan — Yes, you can display subcategories. wp_snap(‘child=true’)
Kyle — Yes, it should be. The error you are getting is because you are using the plugin on an empty category. Enter some content into Wordpress and it will work.
Thomas — 20% of how many posts? If you have thousands of posts, you are probably going to run into problems. The server is going to be cranking through your database to generate that page. Have you ever successfully generated a Wordpress page with hundreds or thousands of posts on it? It’s not a plugin problem really, just a limitation of the web.
July 31st, 2009 at 12:35 am
Is there a way to alphabetize the posts using WP-SNAP?
On the site I’m working on now “A Glimmer of Hope” is coming after “African Studies”
August 4th, 2009 at 12:36 pm
In addition to the problem I’m having above, I discovered today that the “Ignore When Alphabetizing” field isn’t working. I have “the,a,” in the field but things are still being listed by ‘The’. Anyone have any ideas?
August 7th, 2009 at 11:26 am
Disregard comment #412, I wasn’t reading the directions clearly (which is usually the problem with those sorts of requests).
I’m still getting the weird alphabetization problem in #411 – where “A Glimmer” is being alphabetized as “AGlimmer”. I have told it to ignore “A ” for now and that works but I think my client may want to have it on top. Ideas?
Thanks for the great plugin!
August 10th, 2009 at 6:38 am
Excellent!
can it be used to sort tags as well?
August 27th, 2009 at 1:57 am
Thank you for answer Nathan. When i’m say 20 % of all my post, all my post represent around 150, 200 posts and pages.
August 28th, 2009 at 6:58 am
Sorry if I missed this somewhere, but how can I get the index to appear for only one category?
My site has several categories on which I do not what the alphabetical index to show. Is there anything I can add in the ‘arguments’ field to have the index only appear on only one category’s page?
Thanks
September 5th, 2009 at 6:47 pm
Hi,
unfortunately my site does not have a category.php.
Where else can I or should put the code to make this plugin work?
Thanks in advance for any helpful hint.
September 7th, 2009 at 5:47 pm
Jeph — The current sort function in the plugin is the php function, natsort(). If it’s not alphabetizing things the way you want, there’s not much I can do about it. There is a newer version of the plugin floating around on my hard drive in which I started building my own sort function (so that international languages would be better supported), but it’s not really ready for release. Unfortunately, I don’t really have much time these days to work on this plugin.
mhhuk — No, you cannot.
Thomas — Same question: can you normally display 200 posts at a time? If you cannot display that many posts when not using the plugin, then you will not be able to do so when using the plugin. I mean, what you’re saying is that the plugin lists all posts down to, say, the letter “J” and then stops, right? Or are you saying that the plugin randomly omits posts throughout the alphabet? If it’s random omissions, you should see if those posts have anything in common. Are they all in the same category, for instance? Perhaps it has something to do with how you set up the plugin.
Richard — You should use the Wordpress conditional tag is_category().
Petra — You can put the plugin on any part of your site that you want. If you don’t have a category.php file, you can make one. Unfortunately, I do not have the time to help you with this. Good luck!
September 7th, 2009 at 8:22 pm
Hey Nathan, was just wondering if it were possible to place the navigation on single pages too? I’ve tried using on single.php:
But this shows all posts starting with the same letter. Any advice you could offer would be great!
October 2nd, 2009 at 9:18 am
Hello
I’m using this plugin on my site http://www.marketcolorz.com under glossary page. But its not working fine, as soon as I add the desired code for alphabetical listing, its showing many errors and warnings.
October 4th, 2009 at 7:22 am
Mike — Yes. This is the code:
if (function_exists(‘wp_snap’)) { echo wp_snap(‘cat=1′);
Where “1″ equals the category you wish to display on the page.
Varun — If you have no posts in the category, the plugin displays errors. You need to enter posts into the category.
October 4th, 2009 at 3:27 pm
Hi Nathan,
I’ve got some strange problem with plugin. Every thing works fine, but when I click on some letter, category shows posts beginning with some other letter. You can check here: http://www.playportal.cz/download
For example – let’s click to N letter – category returns you article “Download: TeamSpeak”.
I have excluded “Download: “. But doesn’t works even if I don’t do it.
Thank you very much for help. Best regards, weckho
October 10th, 2009 at 6:39 am
weckho — I cannot duplicate your problem using the latest version of the plugin and Wordpress 2.8.4. My guess is that the problem has to do with the fact that your site is running in another language. Unfortunately, while I made some progress in this area, I have never fully implemented multi-language support for the plugin.
October 10th, 2009 at 12:20 pm
Thanks for quick reply – could you, please, be more factual about the language problems? What acctualy could cause this problems? If you provide me more informations, maybe I will be able to fix it myself (I’ve got advance PHP skills). Now I have no idea, how can language of the site affect the plugin function.
Many thanks, weckho
October 10th, 2009 at 2:01 pm
weckho — Your language uses a different alphabet from English. The plugin’s main function is to sort words by alphabetical letter order — the plugin’s sort function have to be written an entirely different way to support alphabets other than English.
There is an experimental version of the plugin that offers international character support. I am not comfortable releasing it to the general public because it has not been tested enough. I will email you a copy.
October 10th, 2009 at 2:23 pm
Is there a way to select more than one category for display? For example, I have 4 categories I want to display on a master page (with 4 sub-pages that just show the results from one category each).
I tried playing with cat=6,8&firstload=all and cat=6&cat=8&firstload=all but neither work.
Is it possible to display all of the posts from a more than one category but NOT ALL categories?
October 13th, 2009 at 1:34 pm
Cliff — No, you can only select one category. But you can include child categories, so that could solve your problem if you were willing to group those 4 categories under one main category.
However, I can see how it would be preferable to be able to include more than one category. I’ll see what I can do.
October 13th, 2009 at 2:01 pm
Love the plugin, finially got it to work except….
What’s the format to allow multiple criteria?
I am trying to limit to a specific catagory, but allow child catagories.
Here’s what I’ve tried so far (catagory numbers are correct for my installation)…
Works but no child cats
Same as above
Same as above
What format should I be using for multiple criteria?
October 16th, 2009 at 4:31 pm
Ooops code got removed
‘cat=123′
tried this
‘cat=123′ , ‘child=true’
and this
‘cat=123, child=true’
October 16th, 2009 at 4:34 pm
Description seems to say this plug is for Posts ONLY. Why not also enable for Pages?
October 20th, 2009 at 9:26 am
Propy — An example is given above. It’s just like Wordpress:
if (function_exists(‘wp_snap’)) { echo wp_snap(‘cat=123&child=true’);
mugger — From the first sentence of the plugin description: “creates an alphabetical listing of post titles on a Category or Page template file.” Yes, it works on Pages, you just need to declare a category to display when you add the code to the theme template file.
October 20th, 2009 at 9:56 am
Hi,
I am looking for a way to obtain a glossary of my tags
Since WP-SNAP does a similar thing drawing the posts of a category, would it be possible to tie it somehow to wp_tag_cloud() or tag_list() functions?
Thanks for any advice.
October 23rd, 2009 at 8:19 am
rb — I’m sure it’s possible. I don’t know how easy it would be to do, but feel free to poke through the plugin and experiment. Good luck!
October 23rd, 2009 at 9:44 am
Hi nathan
i messed up with the code and came out with a sort of diminished plugin outputting a ordered list of all the tags on a wordpress site.
if you like to take a look at the code and eventually provide this option, maybe it’s a good start and i want to share back the awful meshing of code i have produced
basically i used your code, substituted a simple mysql query for all the tags of a site and changed the output to be a list of the tags instead of the post for the loop.
you can get my mail from the comment :)
November 1st, 2009 at 12:57 pm
Hi.
Wordpress 2.8.6
WP-SNAP! 0.8.6
Edited page template to include
if (function_exists(‘wp_snap’)) { echo wp_snap(‘cat=3&firstload=ALL’); }
verified that the category has multiple posts.
verified that the category id is 3.
Browsing to the page will result in the following messages, and only “ALL # A B C …” is displayed but not hyperlinked.
This was working fine in wordpress 2.6.5 before I upgraded.
Any ideas? Thank you.
Warning: natcasesort() [function.natcasesort]: The argument should be an array in /home/username/public_html/wordpress/wp-content/plugins/wp-snap/wp-snap.php on line 358
Warning: array_values() [function.array-values]: The argument should be an array in /home/username/public_html/wordpress/wp-content/plugins/wp-snap/wp-snap.php on line 359
Warning: Invalid argument supplied for foreach() in /home/username/public_html/wordpress/wp-content/plugins/wp-snap/wp-snap.php on line 361
December 3rd, 2009 at 12:10 am
That warning only appears when there is no content in the category. There are no known problems with the plugin in 2.8.6. I know it must be frustrating, but I’m afraid to report that the problem you are encountering is user error.
The place to start? Turn off all other plugins and see if the problem persists. If there are posts in the correct category as you say, that’s probably where the issue is.
December 3rd, 2009 at 12:16 am
Hi Nathan,
Thank you.
I have discovered a compatibility issue with
WP Security Scan 2.7.1.2 and WP-SNAP! 0.8.6 running on Wordpress 2.8.6
December 3rd, 2009 at 12:31 am
Hi Nathan,
I’m using your plugin and everything works fine, but I have all the same a question: how can I define the number of posts to show?
For example, instead of displaying all the posts beginning with letter “A” I would like to display only 10 and then get the previous/next links.
I played with the “blog pages show at least 10 posts” in the settings but it had no effect.
I think this question has already been raised but I was not able to find a solution.
Any idea?
Thanx in advance!
December 11th, 2009 at 1:45 pm
Seb — You haven’t been able to limit the number of posts because the plugin does not do pagination. Pagination is not a trivial upgrade to the plugin and I don’t have the time to write in that functionality right now. Sorry.
December 11th, 2009 at 1:58 pm
Hi Nathan,
I’d like to have ALL of my posts display A-Z on one of my pages, with the nav menu at the top of the page. Not using a specific category, just querying all posts for one giant glossary. Is that possible? Or would I have to go back and categorize every single post with a ‘glossary’ category?
Thanks.
December 12th, 2009 at 7:42 am
Taylor — Yes, the instructions for doing that are above.
if (function_exists('wp_snap')) { echo wp_snap('cat=all'); }December 13th, 2009 at 12:46 am
I see how to call all categories, but I am working in page.php with an if is_page statement. I have one set page where I want this all to take place. Still possible?
Thanks.
December 13th, 2009 at 5:59 am
Taylor — Yes, it works on Pages. It’s the exact same code.
December 14th, 2009 at 1:27 am
Thanx for answering, I hope you will think about it for a future upgrade ;)
Anyway, I’ve found an alternative solution! I use a Jquery pagination system. It was really easy to integrate for my need, you should take a look :)
Greetings.
Seb
December 20th, 2009 at 12:02 pm
I’ve used your plugin with new 2.9.1 but doesn’t work.
I’ve post in category but it say me always
Warning: natcasesort() expects parameter 1 to be array, null given in \wp-content\plugins\wp-snap\wp-snap.php on line 358
Warning: array_values() expects parameter 1 to be array, null given in \wp-content\plugins\wp-snap\wp-snap.php on line 359
Warning: Invalid argument supplied for foreach() in \wp-content\plugins\wp-snap\wp-snap.php on line 361
Warning: natsort() expects parameter 1 to be array, null given in \plugins\wp-snap\wp-snap.php on line 376
Warning: array_values() expects parameter 1 to be array, null given in \wp-content\plugins\wp-snap\wp-snap.php on line 377
I’ve tried with cat=all and with cat= number
but nothing.
January 12th, 2010 at 5:21 am
Ok sorry i’ve found the problem, is the wp security scan that broken your plugin.
January 12th, 2010 at 5:25 am
Looks great, just what I was wanted!
One thing though: is it possible to sort listings using tags? So for example, I’ve selected D and all matching posts are displayed, now within these results I want to sort by tag1, tag2 and tag3 (the could be for example, location, genre etc..
That would be awesome.
January 25th, 2010 at 4:12 am
Ibrahim — No such functionality exists for the plugin.
February 4th, 2010 at 12:57 pm
Hi,
I created a specific category-x.php for showing alphabetic index with a list of the posts in the glossary-category. that works fine and links to the specific post.
Now I want define a specific single.php for the glossary entries, which shows the alphabetic index, too.
But the index links to /glossary_cat/post/letter and after the loop (with the specific glossary post, f.e. “internet”) sadly it shows all loops with the letter A, too.
There are any possibility to show the alphabetic index above the glossary post (which is an article in a specific category)?
Thanks for your hard work.
Greetz from Brazil,
BrasilOnline
February 6th, 2010 at 3:58 am
Assuming each definition is in a single category, something like this should work. I’m afraid that if you need something more complex, you’ll need to do the work yourself. But, yes, it can be done.
foreach(get_the_category() as $category) { $thecat = $category->cat_ID; }
if (function_exists(‘wp_snap’)) { echo wp_snap(‘cat=$thecat’); }
February 6th, 2010 at 10:16 am
Pages: « 1 2 3 4 5 6 7 8 [9] Show All
Leave a Reply