Conversation
supportI’ve noticed your plugin echoes a script at the top of any page when the shortcode is being used. There is an issue with Yoast SEO XML Sitemap with pages using your shortcode. It adds the inline script outside of the WordPress normal method. So when viewing page-sitemap.xml I get an error saying the sitemap is invalid, because xml files should never have any javascript running. This page contains the following errors: error on line 11 at column 7: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error. jQuery(document).ready(function(){ jQuery("#fcywctax.rotate-text").textrotator({ animation: "spin", separator: "|", speed: 10000 }); }); Here is my fix in file saeid-text-rotator.php:43 //echo $rotatejquery; wp_add_inline_script( 'saeidrotate-inline-script', $rotatejquery ); This topic was modified 7 years, 10 months ago by Clement Gonnet . This topic was modified 7 years, 10 months ago by Clement Gonnet .
Unfortunately, the fix doesn’t do the job. It takes a while to test it because the sitemap isn’t regenerating ad hoc but when Yoast wants to. Explanation found here: https://wordpress.stackexchange.com/questions/235905/how-to-add-inline-css-js-inside-a-shortcode I’ve tried also adding !is_feed() before the shortcode is rendered, but that doesn’t seem to work either. Author, can we have some help here?
Unfortunately, the fix doesn’t do the job. It takes a while to test it because the sitemap isn’t regenerating ad hoc but when Yoast wants to. Explanation found here: https://wordpress.stackexchange.com/questions/235905/how-to-add-inline-css-js-inside-a-shortcode I’ve tried also adding !is_feed() before the shortcode is rendered, but that doesn’t seem to work either. Author, can we have some help here?