• Resolved russkemp

    (@russkemp)


    Script working from plugin but only shows after footer not in body which is where it is added.

    What am I missing?

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author David Artiss

    (@dartiss)

    It’s likely that this is due to the script itself positioning the output there. This plugin simply runs the script you provided at the point of the page load that you added it.

    Are you able to provide me with the script that you’ve embedded?

    Thread Starter russkemp

    (@russkemp)

    Hi David

    Thanks for the quick response, the code is below:

    ———————————–

    <script type=”text/javascript”>var _cb = parseInt(Math.random() * 99999999);document.write(‘<sc’ + ‘ript type=”text/javascript” src=”https://capuretheday.shootproof.com/remote/chooser?events=1&email=1&language=en_GB&cb=&#8217; + _cb + ‘”></sc’ + ‘ript>’);</script>
    ———————————–

    Kind Regards

    Russ

    Plugin Author David Artiss

    (@dartiss)

    I can see the output at line 3841 of the page output, which is definitely in the footer.

    Where are you adding the script? Are you using the classic editor or the block editor?

    Thread Starter russkemp

    (@russkemp)

    Im using a block (I think) Gutenburg editor and I get the same when using WPBakery builder

    Plugin Author David Artiss

    (@dartiss)

    Something is very odd and I’m wondering if your use of WP Rocket is behind it – there’s a comment in your page output to say it’s cleaned and sped up your page, but I notice that the outputted code (by my plugin) doesn’t have the usual comments around it. I’m wondering if WP Rocket has modified the output in some way (one thing that performance plugins will do is move scripts to footers or headers). Does the same occur without WP Rocket active?

    Thread Starter russkemp

    (@russkemp)

    I’ve tried with JS no cached, then tried with WP Rocket in safe mode and finally deactivated the WP Rocket plugin (currently still deactivated) It still appears at the bottom ??

    Plugin Author David Artiss

    (@dartiss)

    So very, very odd. Yes, you’re right – that’s definitely turned off now but it’s still doing it.

    If you’re in a position to do this, or have a test site, it may be worth just trying to turn off all plugins (other than Code Embed) to see if that makes a change. If not, try a default theme like Twenty Twenty.

    Thread Starter russkemp

    (@russkemp)

    Looks like Jetpack Boost was the cause with Defer Non-Essential JavaScript enabled

    Plugin Author David Artiss

    (@dartiss)

    Ah brilliant – I’m glad you identified it. Yes, I thought something moving around scripts may have been behind that. I’ll bear that in mind if anyone else reports a similar issue!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Script working but only shows after footer not in body’ is closed to new replies.