WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] ReferenceError: ratingsL10n is not defined (12 posts)

  1. Hell_Lord
    Member
    Posted 7 months ago #

    I was having these two problems with the plugin on my website ratings_off is not defined | current_rating is not defined.

    They were solved by adding this line to the header of the site theme <script type="text/javascript" src="http://www.jogossexo.net/wp-content/plugins/wp-postratings/postratings-js.js"></script> but now it is giving this error ratingsL10n is not defined

    Any chance anyone know what this is about? Since I unfortunately could not resolve this error =/

    By the way, sorry for my english, I'm using google translator because the English is not my native language.

    http://wordpress.org/plugins/wp-postratings/

  2. Lester Chan
    Member
    Plugin Author

    Posted 7 months ago #

  3. Hell_Lord
    Member
    Posted 7 months ago #

    I did this and still did not solve the problem

    EDIT

    Had not tested before posting this, thanks for the help :)

  4. Lester Chan
    Member
    Plugin Author

    Posted 7 months ago #

    @ Hell_Lord: what is your site URL?

    The error ratingsL10n is not defined means that <?php wp_footer(); ?> is not in your theme footer.php. If you are sure that it is there, that means that you might be using a caching plugin and the plugin is serving a stale page which is generated before WP-PostRatings is activated.

  5. Hell_Lord
    Member
    Posted 7 months ago #

    The site with the problem is http://www.jogossexo.net/

    The link to download my footer.php ~~> https://mega.co.nz/#!OYp1HChY!Ky3562qTolQui533luN4XUgaTFY3UNclWArdOYLG7oQ

    My intention was to make the post ratings plugin work, with what you said before is now working, however the console still shows the error ratingsL10n is not defined.

  6. Lester Chan
    Member
    Plugin Author

    Posted 7 months ago #

    I checked your footer.php, the code is there and when to your site and the JS is there. I can't really check more in dept because your site is NSFW and I am work.

  7. Lester Chan
    Member
    Plugin Author

    Posted 7 months ago #

    I know the problem. Are you including <script type="text/javascript" src="http://www.jogossexo.net/wp-content/plugins/wp-postratings/postratings-js.js"></script> in the header? because it not suppose to be there

  8. Hell_Lord
    Member
    Posted 7 months ago #

    Well, i did o_O

    Should i remove it?

  9. Lester Chan
    Member
    Plugin Author

    Posted 7 months ago #

    Yes!

  10. Hell_Lord
    Member
    Posted 6 months ago #

    The console is no longer showing the error, thank you for the help Lester :3

  11. alex1982
    Member
    Posted 1 month ago #

    So I had the same error and I was wondering why, because I haven't included any files manually, just installed the plugin into an almost fresh installation. I was using W3 Total Cache too, which was running before. I always emptied that cache after changing some wp-ratings options but the error still occurred. Nearby the mouseover and mouseout - functions did not work, mouseout caused broken images instead of the stars. I digged into the source code to find the bug and I found out, that the parseInt() - calls to all ratingsL10n - properties were not called, so ratingsL10n.custom was treated as string and the ratings_off- function tried to load custom images instead of the stars I choose.

    tl;dr
    Long story short - W3 Total Cache default options caused the problem finally. I had the JS minify option "embed type" set to "Default (blocking)" and this caused the error. Changing this option to "Non-blocking using JS" and clearing all caches made it work as it should :).
    I hope this helps someone else, it took me some hours to find that out ...

  12. Lester Chan
    Member
    Plugin Author

    Posted 1 month ago #

    Thanks alex1982 for the share!

Reply

You must log in to post.

About this Plugin

About this Topic