• Resolved Kobus Myburgh

    (@bliksempie)


    I used a plugin called KK Star Rating to rate content on my joke site, and it worked for a while, but it seems the plugin got abandoned. I have replaced it with a new plugin that does not use the wp_postmeta table, but its own structure.

    My pod used to look like this:

    [pods name="jokes" where="age_restriction.meta_value='all_ages' AND CAST(_kksr_avg.meta_value as DECIMAL(12,2)) BETWEEN '4.00' and '5.00'" template="joke"]

    Now, how can I make it use a calculation of the votes (the new plugin, YASR, does not store the average anywhere I could find, but appears to calculate it on the fly). So – is there a way to reference a different table entirely in this pod shortcode that I am using?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Kobus Myburgh

    (@bliksempie)

    My logic and some SQL knowledge tells me that I need a calculation at this point, but would need HAVING instead of WHERE. Any ideas?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @bliksempie

    This might be a difficult one.
    I think the easiest way to handle this is to create a new field for the average value and update each time an update is needed.
    This can only be done in PHP and you’ll need to find out how to get the average value from the YASR plugin.

    Maybe the YASR documentation can help you:
    https://yetanotherstarsrating.com/docs/

    You can use update_post_meta() to update the average value:
    https://developer.ww.wp.xz.cn/reference/functions/update_post_meta/

    Cheers, Jory

    Thread Starter Kobus Myburgh

    (@bliksempie)

    Thank you, Jory. I will check if the documentation allows that – but I would prefer not to update the plugin’s source, because when it updates, the changes will be lost.

    Perhaps I need to look at a different ratings plugin as well. Since this is a “pet project” I will handle that over the weekend.

    Thanks for taking the time to respond.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @bliksempie

    I’m not talking about changing that plugin, only using it’s functionality within your own plugin to extend it’s functionality.
    You might need to learn some basics about how WordPress hooks work and take a close look at the plugin documentation to see what you can use.

    Cheers, Jory

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Getting meta data from new plugin into pod template.’ is closed to new replies.