-
AuthorPosts
-
November 27, 2013 at 1:55 pm #193877
Hi there.
I needed to add a script to head. It is a script for translating a jquery UI datepicker for Gravity Forms.
I tried adding it to the google analytics field in the theme options.This did work. But it destroyed all my galleries and sliders.
Is there a better way to add scripts to head?
This is the code i added:
<script type="text/javascript" src=".../js/jquery.ui.datepicker-sv.js"></script> <script> jQuery(document).ready(function($) { $.datepicker.setDefaults($.datepicker.regional['sv']); }); </script>
November 28, 2013 at 1:13 am #194129Hi basilicon!
Best way would be using wp_enqueue_script:
Create a js/custom.js file and put this:
jQuery(document).ready(function($) { $.datepicker.setDefaults($.datepicker.regional['sv']); });
Then add this to functions.php:
<?php function custom_function() { wp_enqueue_script( 'datepicker', get_template_directory_uri() . '/js/jquery.ui.datepicker-sv.js', '', '1.0.0'); wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', '', '1.0.0'); } add_action( 'wp_enqueue_scripts', 'custom_function' );
Regards,
JosueNovember 28, 2013 at 6:27 am #194170hello- I just had the same issue, I added a javascript into the google analytics section and it now wont load my admin pages. I went into the database and edited the ‘avia_options_enfold’ field and now none of my admin section will load. below is the code i have now. Is there something missing from it now?
thanks for any assistance!
a:1:{s:4:”avia”;a:89:{s:17:”avia-nonce-import”;s:10:”89bbd22555″;s:9:”frontpage”;s:3:”734″;s:9:”undefined”;s:32:”header_setting::{contains}social”;s:8:”blogpage”;s:0:””;s:4:”logo”;s:72:”http://skipjackweb.com/wordpress/wp-content/uploads/2013/04/skipjack.png”;s:7:”favicon”;s:70:”http://www.skipjackweb.com/wp-content/uploads/2013/04/boat_favicon.jpg”;s:9:”analytics”;s:239:”;s:12:”color_scheme”;s:6:”Orange”;s:14:”google_webfont”;s:17:”Open Sans:400,600″;s:12:”default_font”;s:17:”Open Sans:400,600″;s:16:”color-body_style”;s:9:”stretched”;s:16:”color-body_color”;s:7:”#111111″;s:14:”color-body_img”;s:0:””;s:22:”color-body_customimage”;s:0:””;s:14:”color-body_pos”;s:13:”center center”;s:17:”color-body_repeat”;s:6:”repeat”;s:17:”color-body_attach”;s:6:”scroll”;s:24:”colorset-header_color-bg”;s:7:”#ffffff”;s:25:”colorset-header_color-bg2″;s:7:”#fcfcfc”;s:29:”colorset-header_color-primary”;s:7:”#f05a1a”;s:31:”colorset-header_color-secondary”;s:7:”#ff7337″;s:27:”colorset-header_color-color”;s:7:”#333333″;s:28:”colorset-header_color-border”;s:7:”#e1e1e1″;s:25:”colorset-header_color-img”;s:0:””;s:33:”colorset-header_color-customimage”;s:0:””;s:25:”colorset-header_color-pos”;s:13:”center center”;s:28:”colorset-header_color-repeat”;s:6:”repeat”;s:28:”colorset-header_color-attach”;s:6:”scroll”;s:22:”colorset-main_color-bg”;s:7:”#f8f8f8″;s:23:”colorset-main_color-bg2″;s:7:”#ffffff”;s:27:”colorset-main_color-primary”;s:7:”#f05a1a”;s:29:”colorset-main_color-secondary”;s:7:”#f05a1a”;s:25:”colorset-main_color-color”;s:7:”#666666″;s:26:”colorset-main_color-border”;s:7:”#e1e1e1″;s:23:”colorset-main_color-img”;s:0:””;s:31:”colorset-main_color-customimage”;s:0:””;s:23:”colorset-main_color-pos”;s:13:”center center”;s:26:”colorset-main_color-repeat”;s:6:”repeat”;s:26:”colorset-main_color-attach”;s:6:”scroll”;s:27:”colorset-alternate_color-bg”;s:7:”#ffffff”;s:28:”colorset-alternate_color-bg2″;s:7:”#f8f8f8″;s:32:”colorset-alternate_color-primary”;s:7:”#f05a1a”;s:34:”colorset-alternate_color-secondary”;s:7:”#f05a1a”;s:30:”colorset-alternate_color-color”;s:7:”#888888″;s:31:”colorset-alternate_color-border”;s:7:”#e1e1e1″;s:28:”colorset-alternate_color-img”;s:0:””;s:36:”colorset-alternate_color-customimage”;s:0:””;s:28:”colorset-alternate_color-pos”;s:13:”center center”;s:31:”colorset-alternate_color-repeat”;s:6:”repeat”;s:31:”colorset-alternate_color-attach”;s:6:”scroll”;s:24:”colorset-footer_color-bg”;s:7:”#333333″;s:25:”colorset-footer_color-bg2″;s:7:”#222222″;s:29:”colorset-footer_color-primary”;s:7:”#aaaaaa”;s:31:”colorset-footer_color-secondary”;s:7:”#ffffff”;s:27:”colorset-footer_color-color”;s:7:”#aaaaaa”;s:28:”colorset-footer_color-border”;s:7:”#555555″;s:25:”colorset-footer_color-img”;s:0:””;s:33:”colorset-footer_color-customimage”;s:0:””;s:25:”colorset-footer_color-pos”;s:10:”top center”;s:28:”colorset-footer_color-repeat”;s:8:”repeat-x”;s:28:”colorset-footer_color-attach”;s:6:”scroll”;s:24:”colorset-socket_color-bg”;s:7:”#111111″;s:25:”colorset-socket_color-bg2″;s:7:”#000000″;s:29:”colorset-socket_color-primary”;s:7:”#ffffff”;s:31:”colorset-socket_color-secondary”;s:7:”#eeeeee”;s:27:”colorset-socket_color-color”;s:7:”#eeeeee”;s:28:”colorset-socket_color-border”;s:7:”#161616″;s:25:”colorset-socket_color-img”;s:0:””;s:33:”colorset-socket_color-customimage”;s:0:””;s:25:”colorset-socket_color-pos”;s:13:”center center”;s:28:”colorset-socket_color-repeat”;s:6:”repeat”;s:28:”colorset-socket_color-attach”;s:6:”scroll”;s:9:”quick_css”;s:0:””;s:17:”responsive_layout”;s:10:”responsive”;s:15:”websave_windows”;s:6:”active”;s:10:”blog_style”;s:10:”single-big”;s:14:”portfolio-slug”;s:14:”portfolio-item”;s:14:”header_setting”;s:47:”nonfixed_header social_header bottom_nav_header”;s:5:”phone”;s:12:”240.400.0329″;s:12:”social_icons”;a:4:{i:0;a:2:{s:11:”social_icon”;s:8:”facebook”;s:16:”social_icon_link”;s:65:”https://www.facebook.com/pages/Skipjack-Web-Services/121025660803″;}i:1;a:2:{s:11:”social_icon”;s:7:”twitter”;s:16:”social_icon_link”;s:31:”https://twitter.com/skipjackweb”;}i:2;a:2:{s:11:”social_icon”;s:5:”gplus”;s:16:”social_icon_link”;s:51:”https://plus.google.com/110449223719007282155/posts”;}i:3;a:2:{s:11:”social_icon”;s:4:”mail”;s:16:”social_icon_link”;s:35:”http://www.skipjackweb.com/contact/”;}}s:11:”header_menu”;s:16:”mobile_drop_down”;s:14:”archive_layout”;s:13:”sidebar_right”;s:11:”blog_layout”;s:13:”sidebar_right”;s:13:”single_layout”;s:13:”sidebar_right”;s:11:”page_layout”;s:13:”sidebar_right”;s:16:”page_nesting_nav”;s:4:”true”;s:22:”display_widgets_socket”;s:3:”all”;s:14:”footer_columns”;s:1:”3″;s:9:”copyright”;s:184:”© Copyright – Skipjack Web Services. Boat images copyright Skipjack Photography“;}}
November 28, 2013 at 11:16 am #194272Hey!
What is the script or code that you added on the google analytics field? Note that the field is strictly for google analytics code. Please post the code on pastebin.com.
Best regards,
IsmaelDecember 4, 2013 at 8:41 am #195997Thanks guys i got it sorted. Thought the analytics field was just a regular “add to head” -field. But it was not.
December 4, 2013 at 4:10 pm #196166You are welcome, glad we could help :)
Regards,
Josue -
AuthorPosts
- The topic ‘Add script to head’ is closed to new replies.