WordPress.org

Forums

Sorting a table by a "vote" count (11 posts)

  1. pressrow
    Member
    Posted 6 years ago #

    Okay...I'm curious to see if this is possible, and if so, how it can be done.

    I already have a table that with sortable column headings. (For the sake of this discussion, let's say it's a list of NFL teams.) Each "team" has their own little info page that's linked up and accessible through this table.

    Here are the things I'm looking to do with this...

    1. I want to give readers the ability to "vote" for their favorite team, right on the table. As in, the rightmost column would be a kind of "Vote for this team" button. Is there a plugin that offers that kind of functionality?
    2. Ideally, the vote would be such that I can sort the table by vote count.
    3. To go along with that, I'd like the table's default order to be the "teams" with the most votes, from highest to lowest. (I use the wp-Table plugin to manage my table, so I don't know if that's possible under it's current format.)

    Is this at all possible? It's for sure outside of my expertise, so I greatly appreciate any help and I thank you all in advance.

  2. flick
    Member
    Posted 6 years ago #

    I'm not sure, but I think you might find this plugin Star Rating for Reviews useful.
    http://www.channel-ai.com/blog/plugins/star-rating/

    It will need to be customised slightly to your needs, but if I were in the same boat, I think this is where I'd start from :)

  3. pressrow
    Member
    Posted 6 years ago #

    Wow--incredible timing mosey, I was just checking that plugin out a moment ago. That plugin is so so so close to what I'm looking for, but it doesn't look like it gives readers the ability to vote themselves. The "rating" itself is static, to the amount that I assign it. But, thanks for the suggestion.

  4. flick
    Member
    Posted 6 years ago #

    Good point there, pressrow! ;) I'm afraid I must have somehow blanked out that particular part when I was reading through your post, apologies!

    It would certainly be interesting to see if there is a plugin that can do this, as I'm sure that I'll find this function useful in the future.

    Maybe it's a case of combining an existing vote/rating plugin with another plugin? It could even be a post-rating one, since I presume each 'team' will essentially have a post associated with it.

  5. pressrow
    Member
    Posted 6 years ago #

    I've thought about the post-rating plugins that currently exist, on that note. I'm sure one of them would kind of fit the bill, but most of them miss out in one key aspect--usually, giving the reader the ability to vote right from that table, rather than having to go to each individual page.

    The reason that's so important is because the importance of this table I'm imagining basically hinges on the ability to show who's getting the most votes (by sorting it according to votes). With most of the post rating plugins, there's no way to take those voting totals and display them in another page (ie, the table) for the sort.

  6. flick
    Member
    Posted 6 years ago #

    It seems it's possible to vote for posts using GamerZ's PostRatings plugin (demo) if the posts are displayed in a category form, so perhaps if the category page was modified to display the results in a table form, this *may* resolve the issue of voting from just one table.

    Still trying to think about sorting that table though. I know that Alex Rabe's Javascript for sorting the table is from Frequency-decoder.com , which seems to provide quite a lot of documentation. Perhaps the comments section might be a useful resource as well. I'm going to try and poke about it too.

  7. pressrow
    Member
    Posted 6 years ago #

    Hmm, that's interesting. The category idea is a decent idea, now that you mention it. I dabbled in a bit of HTML in school, but it was nothing beyond making frames and things like that--so, I'm kind of re-educating myself as I go. I'd need to learn a little more about playing with the categories page.

    There are plenty of sample tables out there that pretty much show exactly what I'm looking for, although most of them are just user-input stars (like the Star Ratings for Reviews plugin). So, I'm fairly confident that it's possible--whether it will require the cooperation of many plugins or not.

  8. pressrow
    Member
    Posted 6 years ago #

    Like this... http://tablesorter.com/docs/

    The "rating" system I'm looking for doesn't even have to be anything fancy, like stars or boxes or whatever. Actually, it would really fit more what I'm looking for if it was just a straight up numeric tally of positive votes, like Digg or Reddit.

  9. flick
    Member
    Posted 6 years ago #

    I find editing the category page one of the easiest things things to do (along with post page) in WordPress, so I'm sure it wouldn't be too much of an issue for you.

    And funny you should mention Digg or Reddit; I had come across a plugin called Vote It Up which kind of does what you were thinking of - just a tally of the number of votes in a Digg/Reddit format.

    I haven't yet tested the plugin (nor seen a working demo) but perhaps this might actually be closer to what you were looking for.

    p/s: Yes, I think FD and TS are both achieving the same effect/result - table sorting dynamically with javascript.

  10. pressrow
    Member
    Posted 6 years ago #

    Vote It Up seems like it would be perfect for what I need. I'm not sure if I'd be able to sort the table by its results, but I also haven't been able to try it because I don't know how to properly install it. Still learning. :)

  11. flick
    Member
    Posted 6 years ago #

    From what I can tell (and I don't anything about javascript really let alone Ajax) it seems both FD and TS allow the re-sorting of data once the vote has been added.

    Perhaps you could share how you eventually do it? :)

    For me the first step would be to construct the category template to display a table form. Then I suppose I'd then work out how to install the ratings plugin, and then the table-sort from either FD or TS.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.