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: « 12 3 [4] 5 618 » Show All

  • Sonali — I am not supporting WordPress 1.2. You can download the plugin and give it a try, but I can’t guarantee it will work.

    GaryP — Neither is an unreasonable suggestion, but they are not features currently available in the plugin. I’ll add them to my list and see what I can do. Thanks for your input!

  • Nathan,

    I posted a request in Gengo’s support forum and one of the members very kindly wrote the new query for me. In fact, he modified WP-SNAP! v0.5.1 for Gengo, as per your suggestion. It works very well!
    Thank you for your wonderful plugin.

    Indi
    :-)

    PS: If anyone using Gengo needs this modification, then I can send it by email. Just contact me through my website.

  • Nathan,

    Your plugin just keeps getting better and better. I would like to move my glossary from a Page to a post using Sören Weber’s Exec-PHP. Do you have any suggestions as to why this isn’t working?

    By the way, if votes influence you at all, I’ll second Gary P’s suggestion about anchor links :)

  • Indi — I’m glad things worked out for you. I grabbed a copy of the hack for Gengo as well. Unfortunately, it’s not something I can really build into the plugin (well, I could if there was the demand), but it’s an easy modification to make to the plugin should someone need to.

    Shanta — Thank you for the kind words. I can’t think why it wouldn’t work, assuming that you’re calling a category when you call WP-SNAP! (e.g.,

    echo wp_snap('15');

    ). However, I never envisioned the plugin being used from within a post, so it could be that there’s some sort of MySQL problem going on there.

    Okay, two votes for anchor links.

  • Hey Nathan
    This seems to be just what im looking for..
    Im soo new at this thou…so i cant figure it out..
    I downloaded the file, i Activate it in plugin…then you say something about

    Add the following line on one of your category pages:

    How do I do that ?
    Sorry for my lack of knowledge.. :):)

  • Jimmie —

    If you look way back up through my comments to about April 20th, you’ll see that I mention how to alter your archives.php file to use WP-SNAP! Same idea for a category.php file. You make these changes in your theme files. In your case, this would be ./wp-content/themes/default/. Unfortunately, teaching php or html kind of goes beyond the scope of this page. There are lots of resources on the web devoted to this — good luck.

  • Hi Nathan,

    thanks for this great plugin. I had to struggle a few to get it running. But now there it is:
    http://web.consultants.at/websolutions/glossar/

    So one hint from me to other users - and one question to you, Nathan.

    First the hint:
    If you don’t want to show each new post of the glossary on the frontpage, just edit the timestamp to a date before the blog has been started. Or select for your blog always the 1st of month or something like this. So I fixed this problem without wasting a lot of time by searching other plugins.

    Now my question to you, Nathan:
    Please have a look at the running glossary:
    http://web.consultants.at/websolutions/glossar/

    and now look at this one:
    http://www.roks.xmgfree.com/blog/glossary/

    how yan I make mine lok like this - depending the view of the single posts. I hope you know what my problem is.

    Is this depending on the theme I use? Or can I change something to make it the way, that not all posts are displayed, but just the letter chosen?

    thanks a lot for a hint
    austrian greetings
    ingrid

  • Great plugin!
    Can I exclude post in category (category used for creating glossary) from RSS feed?

  • Love the plugin, but I have a suggestion. Could future versions have the option to simply have “#ABCDEFGHIJKLMNOPQRSTUVWXYZ” instead of “01234…ABC…”? Thanks!

  • Yeah, I was wondering about that, too. I’d like to clump all the movies that begin with numbers under a single “#” heading instead of having a separate heading for every number. Is there any way to make that possible?

  • I have the code on my archives.php file and I’m getting the following error on category pages. Any help?
    Ken

    Warning: natsort(): The argument should be an array in /home/chenchbr/public_html/quotes/wp-content/plugins/wp-snap.php on line 231

    Warning: array_values(): The argument should be an array in /home/chenchbr/public_html/quotes/wp-content/plugins/wp-snap.php on line 232

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

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

    Warning: array_values(): The argument should be an array in /home/chenchbr/public_html/quotes/wp-content/plugins/wp-snap.php on line 274

    #
    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
    No articles found.

  • Wow! Lots of questions. Sorry for taking so long to respond.

    Ingrid — If you are only excluding one category from your main page (e.g., “glossary” with a cat id of “12″), you could also use query_posts(’cat=-12′); to remove those postings from your front page.

    As to your second problem, open up the php category file you are using for your glossary and remove the WordPress loop from below of where you call WP-SNAP!

    Lalex — RSS feed control in WordPress is pretty primitive. You could exclude a specific feed from being accessible through your .htaccess file, but it’s not currently possible to dictate what categories appear in your general feed.

    Someone should write an RSS feed plugin.

    Scott & lithium — I can do this. Thanks for the feedback. I’ve added this to my to-do list.

    ken — WP-SNAP! does not work if there is no content in the category. This appears to be your problem.

  • Actually, I just realized I had left in an apostrophie. So yes, I guess category id (11′) did not exist. :-) Thanks!
    Ken

  • Nathan,
    Something weird. I’m getting posts listed that don’t belong in the selected list. Meaning, I select A-D on my site and I have posts that show with their titles starting with “G”, etc. The URL: http://www.chench.com/quotes/alphabetical-index-of-authors/

    Ken

  • Thank you very much, Nathan!

    Sounds simple. Weekend is coming soon and than I will try to fix this.

    have a nice day and good luck to you
    greetings
    ingrid

  • Ken — Checked your link. I don’t see the problem? Looks okay to me.

    ingrid — Good luck!

  • I still see it. It’s a quotes site and the quote author is used as the subject of the post. When I click on the “A-D” link I get a whole bunch of A-D plus Naploeon Bonatarte, George Carlin, Thomas Fuller, etc.

    Is that not what you’re seeing? http://www.chench.com/quotes/alphabetical-index-of-authors/?snap=ABCD

  • Ken — Ack! You’re right. I have no idea what’s going on there. Unfortunately, I won’t have a chance to fix this for a few days. One question: If you change the menu type, does the problem persist? Okay, second question: Are you excluding any words? If so, can you copy and paste them as you entered them?

  • The problem does persist when changing the menu type. It’s now A-Z. I had no exclusions and just added “the” for fun but same result. I’ve been comparing the stray listings and there’s nothing different about them than there is with the proper listings.

    Don’t worry about the delay. I appreciate you looking into it when you can. Enjoy the few days.
    Ken

  • Hey,
    Great plugin…I was wondering if it would be possible to add a feature in your next release. Something like a checkbox for the user to list postings in either all the categories or each individual category only. Something like the google search function through adsense …theres a box to select search google or search your site. Perhaps allow the webmaster to pick which categories would be available for users to pick from? Thanks…

  • Pages: « 12 3 [4] 5 618 » 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.