To follow up on the previous issue reported here. I would like to share a suggestion.
To recap, I use Yoast SEO. The XML sitemap /page-sitemap.xml has extra jQuery added at the top of the xml file, which breaks the page. Google Search Console reports:
Unsupported file format – Your Sitemap does not appear to be in a supported format. Please ensure that it meets our Sitemap guidelines and resubmit.
When I turn off your plugin, the issue is fixed.
The sitemap xml file looks like this:
<script>
jQuery(document).ready(function(){
jQuery("#mwtxmtlv.rotate-text").textrotator({
animation: "spin",
separator: "|",
speed: 10000
});
});
</script>
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.ergo3.co.uk/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:image="https://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd https://www.google.com/schemas/sitemap-image/1.1 https://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
I have discovered that the shortcode ‘saeidrotate’ is instructed to ‘echo’ an inline js script. This is wrong practice as it breaks the WordPress loops. Instead of using ‘echo’, I recommend returning the script as part of the shortcode function.
So instead of:
echo $rotatejquery;
use
return $rotatejquery.'<span id="'.$id.'" class="'.$class.'">'.do_shortcode($content).'</span>';
This has fixed the problem.
Author, it would be a good idea to implement this in your code if this solution is approved.
I’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 );
]]>
I love the rotation plugin. It is doing exactly what i need. But I do not want it to continue looping through the texts and just cycle through once. is this possible?
]]>This seems to happen at random. Was seen on IE 8.
I can’t really give steps to reproduce.
Has anyone noticed this before?
Hi
I would like to format the texts like <b>,
etc … is that possible in any way??
Thansk
//Lars, Copenhagen
https://www.ads-software.com/plugins/saeid-simple-text-rotator/
]]>Hey there, just thought I’d make a request for the next update:
Your conditional js load prevents the shortcode from being used anywhere other than the post content. Possibly adding a simple option either ‘per post’ or ‘sitewide’ to enable the shortcode would be helpful.
Wonderful plugin!
https://www.ads-software.com/plugins/saeid-simple-text-rotator/
]]>I changed it to 12000, 9000, 8000. It stays at 2 seconds instead.
https://www.ads-software.com/plugins/saeid-simple-text-rotator/
]]>Hi, I’d like to use the plugin on my title ({fs}) in the header. How can I accomplish that?
thank you!
that’s my site
https://www.francescosoave.com
https://www.ads-software.com/plugins/saeid-simple-text-rotator/
]]>