• Resolved jgarciamel

    (@jgarciamel)


    Hi,
    In my posts, the yellow stars disappear if I use the shortcode [toc] (for Table of Content Plus plugin) on the same page.
    Any idea?

    Thanks

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor dudo

    (@dudo)

    Hi!

    Short answer:
    I’ve fixed this, you can download YASR again (I’ve not released the new version, you should uninstall and install it again) or just download this file this file and upload it into wp-content/plugins/yet-another-stars-rating/includes/ overwriting the existing one with FTP

    This will fix it.

    Long answer:
    For some reason the callback of the shortcode [TOC] has this code:

    if ( $re_enqueue_scripts ) {
        do_action( 'wp_enqueue_scripts' );
    }

    This should never be done because wp_enqueue_scripts is a WordPress standard hook.

    YASR uses that hook to load a global CONST with wp_add_inline_script

    When the shortcode [TOC] is used, YASR load again the scripts, and since it use a js CONST we’ve the error.

    I don’t know how much this bad practice is widespread, so I added a check, and if yasr global data is already loaded, it will no loaded again.

    Thank you for sharing this!

    Best,
    Dario

    Thread Starter jgarciamel

    (@jgarciamel)

    Oh, amazing, now some incredible yellow stars are appearing!
    Short answer: Thank you.
    Long answer: Thank you very much for your help, dear Dario

    Best Regads,
    Jose Ramon

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Yellow stars disappear with [toc] shortcode’ is closed to new replies.