Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sort Topics Column By Number of Likes (Favorites)

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    not an easy option.

    yes favorites are stored against a user.

    This gives the difficulty that you either:

    a) count favorites on then fly – ie on every page load you would cycle through each user and log the topics they have favorited and count them into an array – this will slow the site and it has to happen on every page load. you’d then store these into post meta.
    b) create some code that will count these using cron every so often, and update post meta
    c) link to the favorite button. So it would need to add when favorited and deduct when unfavorited. then you would need to allow for topics being trashed etc.

    a) is the easiest, but still a chunk of code and has site implications
    b) is probably the most practical, but will only be as current as you run cron, so could be say an hour out of date
    c) is a real bunch of code I suspect, but would be the best solution on a big website.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar