WP-SNAP! WordPress Plugin

Permalink  |  Comments [348]

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:

screenshot

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!

  1. 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.
  2. Activate the Plugin from the WordPress Administration Plugins tab.
  3. 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(); } ?>
  4. Copy the CSS example below and paste it into your WordPress Theme stylesheet (you can style it better later).
  5. Upload the files and refresh the category page on your WordPress blog to see it in action.
  6. 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'); } ?>
  7. 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 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

Technorati TagsTags: , ,


Comments

Pages: « 18 9 [10] 11 1218 » Show All

  • Hey nate! I’m a big fan of this plugin! (Even though I suck as CSS and haven’t restyled it from the default appearance). I have recommended WP-SNAP on the WP forums. If you want to see my site you can find it by googling ‘dgold green lyrics’, it’s not particularly public so I don’t want to link it in your comments.

    I just upgraded from WP-SNAP 5.x to 6.2 and it introduced an error, so I deactivated WP-SNAP until I get this figured out. Help!?

    I don’t know if this has to do with the Queries error you warned about, and I’m hoping you can tell me if that is the source of my problem before I muck around in my query code that I don’t know much about.

    The error is,
    Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] for character class at offset 5 in /MyServer/MyLogin/public_html/MyBlog/wp-content/plugins/wp-snap.php on line 215

    Thanks for any hints & thanks again for the plugin

  • Jeremiah — Currently, no. It’s on the list of possible upgrades, but the changes I made in v0.6 have been more problematic than I expected. So, before I can get to adding new functionality, I need to iron out what I’ve done so far. Sorry I’m so slow.

    dgold — I just looked at line 215 and, not only can I not see anything wrong with the code, it’s not sometime I’ve touched in any recent updates. I’m not getting an error here. If you didn’t install from the zip archive, I suggest trying that.

  • Nathan, sorry for the trouble, can you please think of any advice for me? After WP-Snap 6 didn’t work for me, I tried to go back to WP-Snap 0.5.4, which worked for me before.

    Now it gives me this error message:

    Warning: natsort() [function.natsort]: The argument should be an array in /home/wp-content/plugins/wp-snap.php on line 247

    Warning: array_values() [function.array-values]: The argument should be an array in /home/wp-content/plugins/wp-snap.php on line 248

    Warning: Invalid argument supplied for foreach() in /home/wp-content/plugins/wp-snap.php on line 250

    1. No articles found.

    Any ideas? I’d be so happy to get this plugin back.

    I’ve tried disabling other plugins that I thought might conflict, nothing changed. What else can I try.

  • I am very, very happy to announce the release of WP-SNAP! v0.7. The bugs that plagued version 0.6.x should now all be fixed and I’ve even added some new functionality.

    The biggest news:

    The plugin once again works on Pages!

    I’ve made it so that several variables can now be passed to WP-SNAP!, including one that allows you to select the category to be displayed. This is what allows the plugin to now be called on a Page. You can choose to display one category, one category plus all child categories, or all categories.

    I’ve also made it possible to select which navigational style should be used when WP-SNAP! is called, making it possible to use the plugin in several different places on your site using a different navigational style in each spot.

    Cool, huh? :)

  • I just tried upgrading WP-SNAP from 0.5.4 to 0.7.1 and received similar errors to what dgold was receiving with version 6 of WP-SNAP.

    I am also getting the “Warning: natcasesort() [function.natcasesort]: The argument should be an array in /home/wp-content/plugins/wp-snap.php on line 241″ and others.

    I am still using WordPress version 2.0.2 and plan on upgrading soon. Could this be the problem?

    What version of WordPress has WP-SNAP 0.7.1 been tested with and proven to work?

    Thank you for this great plugin and keep up the good work. I reverted back to 0.5.4 for now, but would like to go to 0.7.1 if possible.

  • I finally got WP-SNAP 0.7.1 working with WordPress 2.0.10. It was related to the “post_type” query on line 209 in “wp-snap.php”.

    It was originally like this:

    $where .= " AND (post_type = 'post' AND (post_status = 'publish'";

    I changed it to the following and it fixed the errors that were appearing in my post above:

    $where .= " AND (post_type = '' AND (post_status = 'publish'";

    The “post_type” option is something WordPress 2.1 and above has values for, but 2.0.x leaves it blank if I am not mistaken.

    I also had to re-enable the WordPress loop on the page to display the articles below the letter choices. Version 0.5.4 automatically display the list of articles, so that threw me a little when I upgraded to 0.7.1. I still need to format the items that the loop generates to look like they use to in version 0.5.4.

    At least I got it working and thanks for the email Nathan, since you pointed me in the right direction that let me figure out the problem.

    Thanks again for the great plugin! :)

  • cnc137 — I’m glad you were able to figure it out. And thank you for posting your solution so that other who might be in your situation can benefit from it. Hopefully you’ll be upgrading WordPress to take advantage of the added security and bug fixes so this won’t be a problem for you long term.

    Yes, WP-SNAP! now uses the WordPress Loop. I know it’s a different way of doing things, but I think the amount of customization that you can now do far outweighs the inconvenience of having to reformat things. It’s the way I should have done it in the first place, if I’d understood how.

  • I totally agree. WP-SNAP 0.5.4 worked great, but the way 0.7.1 uses the WordPress loop opens up all sorts of possibilities. It also allows me to add things to the listing by using WordPress’s template files without having to modify WP-SNAP’s code.

    Thanks again for all your hard work. This plugin is exactly what I need for our redesigned website and hopefully I will be able to get the new design online sooner than later.

  • Hi,

    This is really nice plugin but unfornately it has a conflict with simpletagging plugin.

    I have a book review blog and use simpletagging to show the author of the book.

    I use WP 2.0.1 and simpletagging 1.6.0

  • i have problems with the WP-Snap.
    when i activate the plugins, this affect the post query of my database and appear this error:

    WordPress database error: [Unknown column 'blogroll' in 'where clause']
    SELECT link_url, link_name FROM wp_links WHERE link_visible = ‘Y’ AND link_category != blogroll ORDER BY link_name

    who can help me?

  • hello

    is there an option to limit numer of links per letter, let me explain, i have 156 post titles under letter B, 214 under letter S… and these pages are very big, i need somehow to display first 50 titles, then next 50…. i need an option to paginate pages like this plugin except this plugin is for comments http://www.keyvan.net/code/paged-comments/

    also is there an option for little more seo friendly pages, for example now is site.com/category/blabla/?snap=B i need to be more like site.com/category/blabla/B

    thx in advance

  • Hi,

    I thanks a lot for that great plugin!

    For now, I think there is a simple thing that could do a lot for the plugin: the possibility of choosing which letter does appear selected when we click the category link. Is there any line in the code that can be manually changed for that?

    Another thing: this plugin has the great functionality of allowing us to display more than one letter at once! Like “?cat=yourcatnumber&snap=A+S” to display both posts with A and with S!!!

    Like, to display all posts from the category, alphabetically, we just have to use: …./?cat=yourcatnumber&snap=A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+#

    That’s alll for now!

    Tks!

  • Your plugin has been very useful. Thanks so much.

    I’m having some difficulty, however, getting it to work with a custom plugin that I made to filter posts based on custom meta fields assigned to the post. Would you have any idea why? The plugin I’ve written is pretty standard, and changing the filter priority doesn’t seem to have any effect.

    Thanks again for the wonderful plugin.

  • Chris — WP-SNAP! is probably bypassing your filtering because I do my own database call (by necessity) and then pass the results back to $wp_query->posts. I can’t get the database filtering I need going through filters because filters run before the page loads, and the user needs to be able to make requests as the page loads. However, I could look into filters running on the database results that I pull.

    Fabricio — Interesting! I didn’t know I programmed that in. :) Go me. As far as being able to chose the letter that appears, this wouldn’t take much coding, but I can’t understand why you’d want to do this (not that I necessarily have to — but it might help me understand how big of a need there is for this feature). If I understand correctly, if a user loads a category where WP-SNAP! is called, you want it to start on, say, letter “S” instead of letter “A”? This won’t confuse users? And there’s a benefit?

    happy user — Pagination does not currently exist. It’s a feature I’ve contemplated, but not yet implemented. You are the first to request it.

    djluis — Have you looked for a conflict with other plugins that you have installed? On what template are you calling WP-SNAP!?

    efrasiyab — Thanks for the info. I’ll look into it. Do you know what the conflict is?

  • Hey!

    Great plugin, fast answers! You’re in a good way here right now!

    1) Cool that this great function I mentioned (A+B+…+Z) was there, even if it was just by good luck! ;)

    2) About the featured I suggested, you got it correctly: the big point is not choosing the initial letter to show…….. But leting users choose to show, as initial option, ALL the posts under the category that uses your plugin. My great request indeed is not altering the initial letter, but choosing to start showing ALL posts and not “A” posts.

    To tell the truth, I was really thinking about that: changing letter A from the inicial position could let me, using A+B+C+…+Z as mentioned, to config the page to start not showing posts under A, but all post! What is it usefull for? Because it is a simple way of ordering post alphabetically, not by date!!! And that is pretty great, isn’t it?

    For example: I have a blog where I publish my doctorship program status week-by-week. There is a cetegory to group posts that coment each of my bibliographic references. Then, if I want to call a page with your plugin starting showing all posts alphabetically, I must create a link outside of blogroll that calls ?cat=3&snap=A+B+C…+Z It works, but I have to manage sidebar links out of blogroll AND blogroll just because of that… and believe me: I have a lot of links to show in there!! I gives me a lot of extra work!

    Anyway, if you have any other way of enabling me to start with all posts, just to order them alphabetically, it should be fine! And I will really love it! What do you think about that?

    I hope that all this can be usefull……..

    Thanks and congratulation for the great work until now!

    #195Fabricio Vasselai
  • Wow, great plugin!

    We’ll be using it in our reviews section as it is just what we’re looking for!

    Thanks!

  • Hi, I’m pretty much very happy with your plugin so thank you VERY much. I’m trying to use WordPress to manage all of my stories and poems and your plugin is very helpful (I can organize my poems my title!).

    I have a suggestion as well. Instead of initially showing posts under the first letter (in most cases, “A”), I would like for *none* to show up. It looks like my suggestion is the opposite of Fabricio, who wants all of them to show if I understood correctly. The reason why I’d like that is because the visitors will go to the page and click the letters on their own… I feel there is no need to force any letters to show up for visitors. It’s not that big of a deal but it might be nice ;)

    Thanks again!

  • Hi,
    Thanx for the great plugin.
    I have a problem. in one of the categories which includes 700 posts wp-snap shows a blank page. is it about the number of posts? or is there any other problem? in other categories which has 100 posts or less there is no problem. But only 700 posted one. any suggestion?

  • Hi Nathan - a belated thanks for reintroducing the ability to use WP-SNAP! on pages. Most appreciated. I also wanted to thank you for all the help you provide in these comments–they are among the most useful I’ve seen anywhere in support of a plugin. Thank you for all the hard work.

  • Fabricio & Kim — You’re request has been noted. I will in some future release include a show all/none option.

    Newbie — Thank you for notifying me that there might be an issue with large post counts. If you really strongly believe that the issue lies with the plugin and you’d really like to see it fixed, it would really help me if you did some more investigation and gave me some more information about what’s happening. Specifically, do you know at what number of posts the issue starts occurring? What your post seems to suggest is that the issue might be with categories that have three digit integers (i.e., 100 posts or greater) but does not effect categories with two digit integers (i.e., 99 posts or less). If this is the case, I can definitely dig into this problem and get it fixed, but if it’s some other arbitrary number… well, it would still be useful to know what that is because it might hint at a solution. Thanks!

    Limpit & Shanta — Thank you for the kind words. It always makes me happy to hear that the effort I’ve put into this plugin is appreciated. When I started work on this thing, I had absolutely no idea how much time I’d have to invest to make a plugin that, when it comes down to it, does so little.

    All — It’s been several months since the last time I updated this plugin. That can be attributed to several factors: 1) The plugin now works without any problems (Newbie’s potential issue excluded); 2) I have been very busy; 3) I haven’t really received many requests for additional features. User feedback is a huge motivator for me and, right now, it seems like most people are pretty satisfied with the way things are. That’s a good thing, by the way. :) It seems to me that this plugin pretty much now does what it was designed to do and does it pretty well. There are still some rough edges to smooth out, but I don’t feel any sense of urgency to address those issues. The last major feature I’d like to implement is “pretty” permalinks. And that should happen sometime in the next couple of months. At that point, I will be seriously thinking about moving the plugin’s version to 1.0 to emphasis the its maturity and stability and shift the focus from major feature enhancements to minor bug fixes and upgrades. This is not to say that features you want to see added to this plugin cannot happen — they can! — but I need to hear from you (the users) what you’d like to see happen next.

  • Pages: « 18 9 [10] 11 1218 » Show All

    Leave a Reply

    Allowed markup: a blockquote br code em pre strong ul ol li

Download The Latest Release

WP-SNAP! v0.8.5 (zip archive)

View The Code

WP-SNAP! v0.8.5 (phps)

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

  1. 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.

  2. 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.

  3. 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.