WP-SNAP! WordPress Plugin

Permalink  |  Comments [353]

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: « 13 4 [5] 6 718 » Show All

  • [...] WP-SNAP! Plugin Alphabetische Navigation! [...]

  • Hello, iam a german, so sorry for bad english.

    I install your plugin and it works, but one problem. It dosn’t look like I want.

    It looks:

    1.A
    2.B
    3.C

    and I want see it like:

    #-A-B-C-D-E-F-G-H-I-J-K-L…..

    I use the kubrick theme and paste your css in the style.css. This css:

    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;
    }

    when i choose in the options the style i want nothings happen.

    Can you help me? I hope you understand what i want.

  • This is great. Is there a way to use this plugin to show all posts for all categories? I’d like to use it as a general TOC for the overall site. I’ve tried passing ‘0′ and nothing for categories, but it seems to just take the category of the page I am putting the calling PHP code on.

    Thanks!

  • THANK YOU!!!!!!!!!!!!!!!!!!

    Fantastic plugin. I’ve just put it on my local development site and set-up a few items, it looks like it’ll work brilliantly for me. Thank you!

    A couple things:

    1- Count me as another vote for anchors ;)

    2- Would it be possible to do something about URLs? The format of ‘?snap=A’ seems to veer away from the pretty url available through WP. I’m not sure what the best approach would be, not even sure the plugin itself can handle it, but if it’s possible, maybe skip the question mark in the url? seems it would be easier on the human eye.

  • Hi before I activate your Plugin I have written two posts,
    aktivate wp-snap-wonderful:-)
    write one more post, but wp-snap don’t show this post.

    I’m using wp 2.03 on my testblog

    regards
    Monika

  • Hi! I just wanted to drop by and say thank you for making this plugin. We are using it at NoticIEEEro, our blog and news centre for IEEE Region 9, Latin America and the Caribbean.

  • To Everyone —

    I’m sorry I haven’t been more actively responding to comments the past few weeks, but someone very close to me passed away last week after a long illness and caring for them had pretty much been to focus of all of my free time. I’m still sorting a lot of things out, but hopefully I’ll find a free day soon to sit down and review the potential bugs that have been brought to my attention, respond to comments, and perhaps introduce a new feature or two. Thanks for your understanding.

  • Nathan, no apologies are necessary. I’m so sorry for your loss.
    Take your time. We’re not going anywhere.
    Ken

  • Hi, Nathan. First of all, sorry for your loss. Hope you are fine now.

    In other order of things, I have a doubt about the usage of the plugin. In our glossary we need to sort words in Spanish starting with tilded letters, like “Áreas”. This kind of words are placed in the “#” page. Is there any way to handle this?

    Again, thank you.

    Bests,

    Pablo

  • Hi, like Roberlan, I don’t have any category.php file in my theme (3k2): should I copy the ‘default’ category.php page and put it in my theme? Or what else? Thank you, C.

  • Hi. Iam back. :-)

    I use the “pool” theme and don’t know where to input the php code. I have no categore.php page. please help me.

  • Is it possible to show defenitions on a separate page using this plugins? What I have is actually a short article, so it should be on a different page. Thanks! Nice plugin!

  • Nathan,

    I have two questions.

    1. I have an “index.php” a “categories.php” and an “archive.php” in use on my site. When the “index.php” and “archive.php” is loaded the plugin only registers half of the titles. When the “categories.php” is loaded all the titles are available. Is there a bug here or is there something I have to do to make the plugin work correctly on the other pages?

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

    By the way, this is a very good plugin. Thanks for making it available.

  • Okay, I guess it’s time that I addressed all these comments!

    Ken — Your bug report is at the top of my list. I still am not sure when I will have time to next sit down and work on this plugin, but it’s what I’m going to be looking at first.

    Michael — What you’re asking for is certainly doable, but there’s a lot of work under the hood that would need to be done to get the plugin to that level. It’s been added to my list, but this may not be something I can get to anytime soon.

    Sven — The question you asked is a CSS question. Not only have I suggested how to fix the problem you’re encountering on this very page, but I’ve also requested that users limit their requests for these sorts of tutorials. CSS is a whole other ball of wax, and I don’t really have time to teach that to you. My apologies and good luck!

    Brian — Right now, there is no “all” option. Perhaps there should be. On the difficultly of implementation scale, I would have to give this one a big, fat “I don’t know.” But I think I can do this relatively easily.

    Nic — 1. Another vote down for anchors it is! 2. I hear you. You’d like a “prettier” permalink structure. On the coding side of things, I know how to make this work — the way I’m doing things is convenient because I can easily grab the snap variable that way, but I know of another way to do the same thing. But what should I do on the permalink side? What should this look like? Suggestions?

    Monika — I would guess that you saved but did not publish your new post. Or, that you put it in the wrong category.

    Pablo — Thanks for the kind words. I checked out your site but I didn’t see WP-SNAP! in action. Where is it? Or did you have to pull it because of internationalization issues? You’re alphabetization problem concerns me — I would really like the plugin to handle every “A” letter the same, accent mark or not. I’m putting this near the top of the list.

    Claudio & Sven — I’m sorry, but I don’t have time to research this right now. I can see for more beginner users that this plugin is going to need a help document that answers these kinds of questions. But that may very well require help from other users. Right now, should I get time to work on this plugin, I’m going to need to spend it working on the code.

    Broadcaster — I’m not sure what you’re asking. If you want, you don’t have to show “definitions” at all. Just titles. When the title is clicked on, it should take you to the permalink for that post title.

    Craig — 1. On the index and archive page there is no way for the plugin to know what category you want to display. I’m guessing that on the index page it’s probably grabbing category 0 and on the archive page … I dunno. But WP-SNAP! only knows what category it is if WordPress itself passes that variable to it — which pretty much just happens on the category page. Otherwise, you need to tell it what category to display. Or am I not understanding the bug you’re reporting? 2. Currently, no. But I can do this fairly easily I think. I’ll add it to the list.

    Sheesh, this little plugin of mine is looking to grow way beyond what I originally envisioned! Thank you all for your kind words of praise and encouragement and suggestions. I really appreciate that there are people out there in the world that have found this plugin so useful. I promise to get back to work on WP-SNAP! soon. Thanks again for your understanding.

  • Nathan: Thank you for your answer. WP-SNAP! is being used in our glossary at NoticIEEEro. We didn’t officialy launched it, but it’s working at that URL.

  • Nathan,

    Can the plugin be tweaked to alphabetize all the titles regardless of the category?

  • Pablo — Thanks for the link, I’ll check it out. Should be looking into the accent issue soon.

    Craig — Yes, here’s the hack:

    Open up the plugin in your favorite editor and change line 223 to:

    $wp_snap_posttitles = $wpdb->get_results("SELECT `post_title`, `post_content`, `post_excerpt`, `ID`, `post_password` FROM $wpdb->posts, $wpdb->post2cat WHERE `post_id` = `ID` AND `post_status` = 'publish'");

    That should do it!

  • Wow, I didn’t realize the plugin was in such bad shape! I think I squashed the sort issue — I accidently typed an “i” where I should have typed a “j”. Ugh. I also started toying around with accommodating accent marks, but I’m not done yet. I felt like I needed to get the sort fix out to you guys as soon as possible, so look for another release to finish up the accent mark issue.

    Not quite sure how I’ll fix that one — the letter I know isn’t working right now is “Ê”, which gets interpreted as an “A” somehow. No doubt this effects other accented letters as well. Hrm.

    I look forward to feedback. Let me know if you find any more bugs.

  • Nathan: The issue with accent marks looks like solved, but now when you first access the function, the title list is not filtered (as you can see here). Previously, when you first accessed the function, the list showed filtered by the first used initial.

  • Pablo — The issue with the accent marks may not be solved, but the remaining issues might not effect your use of the plugin. It looks like it may only be very specific letter/mark combinations that are still at issue. Let me know if you encounter any problems.

    Also, I’ve updated WP-SNAP! to version 0.5.3 and have fixed the bug with the list not filtering when you first access the page. Let me know if you notice anything else. Thanks!

  • Pages: « 13 4 [5] 6 718 » 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.