Hello.
Where do I insert this code?
I inserted into functions.php, but nothing has changed.
is it present in latest update of plugin ? do we need to use it now ?
-
This reply was modified 8 years, 4 months ago by
berserk77.
Hello, I have worpres version 4.8.4 I installed the pluggin and put the code
<? php if (function_exists (‘the_ratings’)) {the_ratings (); }?>
in index.php and the stars do not appear anywhere. can you help me? http://blog.origenasturias.com/ http://blog.origenasturias.com/
Ran into a funny problem with this that took me a while to figure out – how can ratings work fine one day but fail to load the next without making any changes to the site?
Turns out this function uses a nonce (randomly generated number) for security, and since it’s right there in the source code it gets cached along the rest of the webpage. WordPress nonce lifetime is 12-24 hrs, so if your cached page is older than that, your nonce will be invalid and ratings won’t load.
Solution is to not cache pages for longer than 12 hrs, or increase nonce lifetime as described here:
https://codex.ww.wp.xz.cn/WordPress_Nonces#Modifying_the_nonce_lifetime