-
AuthorPosts
-
December 14, 2015 at 4:54 am #705745
Hi,
I’m trying to add the following script to my site, using Cornerstone:<script type="text/javascript"> GITWidget.addGolfLogin({ width: 250, guid: '22c55abe-ac3e-4ce6-aed7-ca2a8074648a' }); </script>
I’m adding it in a tab content in “text” mode (not visual). I’m also adding the required script.js through functions.php in my child theme. (http://gitwidgets.golf.se/Widget/script.js)
The script is loading a signin form to a golf service (signing in to “my golf id”).The problem is when I add the script above in Cornerstone, the form gets rendered and everything else disappears.
http://cl.ly/3W363j3x0v0TI´ve tried updating my local environment to latest version of X and Cornerstone but problem remains.
On my stage server I´m using:
WordPress: 4.3.1
X-Theme: 4.1.1
Cornerstone: 1.0.6December 14, 2015 at 5:31 am #705781Hi there,
Please remove the code from text element and add it in raw content element.
Hope it helps.
December 14, 2015 at 6:20 am #705851Hi,
no luck there. Same thing happens. Is there a way of adding the script through shortcode or javascript?December 14, 2015 at 7:07 am #705928Hi there,
Inside CS, you can add JS in raw content element. Upon checking your site I noticed you’re not fully updated please update theme and plugins.
You can find the latest version numbers here: (http://theme.co/changelog/) Then you can compare them to what’s installed on your site.
If you find anything to be out of date, you can review our update guide.
Hope it helps.
January 20, 2016 at 8:23 am #754988Hi again,
The project has been on ice for a while but starting to reach deadline. I still have not got it to work properly. I’ve updated X-theme and Cornerstone to the latest versions but that doesn’t solve the problem. Any ideas on how to add the script without crashing Cornerstone?January 20, 2016 at 9:47 am #755137Hi there,
Thanks for updating. If your codes are correct and other related scripts loaded correctly then it should work within RAW Content. So make sure that the other dependency scripts loaded correctly in order to prevent JS errors that causing the issues.
Cheers!
January 28, 2016 at 1:50 am #768374This reply has been marked as private.January 28, 2016 at 6:17 am #768655Hi Frosting,
You can try a conditional tag to avoid the script to be loading in Cornerstone preview. So your updated code would be:
function load_script_content() { if ( ! isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 ) { return "<script type=\"text/javascript\">GITWidget.addGolfLogin({ width: 250, guid: '22c55abe-ac3e-4ce6-aed7-ca2a8074648a' });</script>"; } } add_shortcode('custom_script', 'load_script_content');
Thank you!
February 2, 2016 at 2:00 pm #776620Hi again,
sorry but this didn´t do the trick. Cornerstone gets stuck in a loop. Any other way?February 3, 2016 at 12:36 am #777359Hi Frosting,
I check your functions.php file and didn’t see the code getting added to it.
Please add this in your child theme’s functions.php (wp-content/themes/x-child/functions.php)
function load_script_content() { if ( !isset($_GET['cornerstone']) && $_GET['cornerstone'] != 1 ) { ?> <script type="text/javascript">GITWidget.addGolfLogin({ width: 250, guid: '22c55abe-ac3e-4ce6-aed7-ca2a8074648a' });/script> <?php } } add_shortcode('custom_script', 'load_script_content');
Then add this in cornerstone
[custom_script]
http://screencast.com/t/JM4hPRYOnS
Hope that helps
-
AuthorPosts