WordPress.org

Support

Support » Plugins and Hacks » New Plugin: WP-SNAP!

New Plugin: WP-SNAP!

  • About a year ago, I had need to create a glossary of terms category in WordPress and had to create a navigation system that allowed terms to be displayed based on their first letter. At the time I was pretty new to PHP (heck, I still am!), so I was lucky to find a thread on here (this one: http://wordpress.org/support/topic/12379 ) that gave me the code I needed to build the system.

    Last weekend, I got an email from someone asking how I got the code to work and I went back to the support thread and discovered that several others had also asked the same question. Rather than take 5 minutes to post some follow-up helpful hints, I spent the last 3 days writing my first WordPress Plugin. 🙂

    If anyone would like to test this plugin for me, or just glance over the code and critique my style, I would be most appreciative.

    http://www.nateomedia.com/wordpress/wp-snap

Viewing 15 replies - 1 through 15 (of 19 total)
  • Hot on the heels of WP-SNAP! v0.1 comes version 0.2. Surprisingly, this is not a bug fix, but a feature enhancement. After reading this thread, I realized that I could very easily modify my plugin to allow you to pre-select the category to be displayed. While not very useful (and perhaps confusing to users) on a Category page, it could be very useful on a Page… uh, page.

    In new version 0.2, you can pass a category to WP-SNAP! thusly:

    <?php echo wp-snap('0'); ?>

    Grab it here: http://www.nateomedia.com/wordpress/wp-snap

    I hear… crickets chirping. Well, I hope someone is finding this plugin useful.

    I have two thoughts for additional features I could implement, but it would be nice to know someone was interested:

    1. (Easy) An option to include the children of the current category in the displayed results.
    2. (Harder) An option to include a numerical paging system at the bottom of the displayed results and the ability to set a hard limit of the number of posts displayed at a time. For instance, say there are 28 posts with titles starting with the letter “B” — one could set a hard limit on displaying 10 post title results per page, with a numerical menu at the bottom something like this:

    < Previous ... 18 | 19 | 20 | 21 | 22 ... Next >

    The last page of “B” results might even include 2 “C” results, and clicking on the next page might finished the “C”s and start the “D”s. Etc.

    Hopefully I’m making some sense. Any interest in something like that?

    ooo that looks very very helpful.. I currently group a newpaper by issues and you can look at an issue archive through an alphabetical list.. would be a useful addition

    This is a nice plugin, indeed – I installed it today on my one and only category page and it works perfectly. Now I find myself wondering how to configure the layout of it, though.

    What I would like to do is to have the menu display in a box inside the sidebar (one I created for the category display only), so it would basically show up as
    a-d
    e-h
    etc…

    but only below the titles. Any hint on how I could achieve that?

    If you want them to display vertically in a box as you’ve shown, you’ll want to add something like this to your style.css file:

    #divname ol.snap_nav {
    padding: 8px 8px 5px 8px
    border: 1px solid #000;
    text-align: center;
    }

    #divname ol.snap_nav li {
    margin-bottom: 3px;
    display: block;
    }

    Okidoke, now I just have to get my site to cooperate… thanks for the help, I really love this plugin since it’s helped me make some of my ideas come true.

    I’m glad you like it. Please let me know if you have any suggestions for making it better.

    Okay, a quick question – how do I tweak the code so the titles and everything else doesn’t show up with the bullets in front of them?

    If you go to http://nyahalcyon.net/archives/category/le-cuisine/ you will see what I mean. I’d like to get the nav list to be in the exact center, maybe even two (a-d e-h, etc) next to each other in one line, and then underneath the titles displayed with maybe 2px padding between the side of the box and the text.

    Sorry, my list html and css is a bit rusty. Enough for ordinary purposes but I am too afraid of changing the code around in the Plugin itself (the one time I did I got myself a nasty SQL error)

    Or now I’ve had a better idea: Would it be possible to have the alphabetical index on the left side in that box in the sidebar, and the titles displayed underneath the one single post?

    There should be no need to change the code in the plugin to get the results you desire. It can all be done through css. To remove the numbers:

    #navigation ol.snap_nav li {
    list-style: none;
    }

    I suggest that you get yourself a book on css — Cascading Style Sheets 2.0: Programmer’s Reference by Eric A. Meyer would be a great place to start.

    I’ve updated WP-SNAP! to version 0.3. I’ve improved how the plugin handles post excerpts. Now, if the plugin finds that a post’s excerpt field is empty, it will create an excerpt from the post content. The length of the excerpt can be controlled from the plugin’s options menu in the admin interface.

    WP-SNAP! v0.3

    I fixed a bug with the navigational menu and have updated WP-SNAP! to version 0.3.1.

    WP-SNAP! v0.3.1

    I’ve update WP-SNAP! to version 0.4. It no longer chokes on post entries beginning with non-alphanumeric characters (i.e., a quotation mark, ampersand, percentage symbol, etc.).

    WP-SNAP! v0.4

    hey how did you make those scrolling text box things like in this picture:

    http://img158.imageshack.us/img158/1674/untitled8iq.png

    I want to be able to do that on my site so the text doesnt move outside into the sidebar

    WP-SNAP! has been updated to version 0.5. It is now possible for the user to define words (such as “the” or “an”) to be ignored when alphabetizing posts.

    WP-SNAP! v0.5

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘New Plugin: WP-SNAP!’ is closed to new replies.