Script not displaying when logged out

Hi, I have inserted a bit of html containing a javascript link into a text element in cornerstone which imbeds a countdown timer from an online service called Countdown Monkey. This works fine when logged in but when I view the same page on another browser or logout of wordpress, the countdown timer disappears. I read somewhere that you need to insert some additional code in the functions.php file to register the javascript and to prevent it from disappearing. I have tried this code:

function x_theme_name_scripts() {
 wp_enqueue_script( 'mc_25x5_ifid', get_template_directory_uri() . 'https://countdownmonkey.com/counter/815/10816s.js', array('jquery'), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'x_theme_name_scripts' );

Unfortunately it didn’t do anything. I’ve attached a screen grab of the timer which is visible when logged in.

Please could you advise me on the correct code.

Many thanks

Lewis

Hi Lewis,

Thank you for writing in and sorry you’re having this issue, we have a bug on this that text element and content element strips some of the property of a custom code when the user is not login.

For now, you can put your custom code on a RAW Content element.

Hope it helps,
Cheers!

Thanks, that was a quick fix. I should have asked this hours ago instead of trying to fix it myself.

Thanks

Lewis

You’re welcome!
We’re glad we were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.