WOW.js Script Tag Initialization Header/Footer

The theme should enqueue styles and scripts on the wp_enqueue_scripts hook, per Codex recommendations. function theme_enqueue_scripts() // register wow.js & animate.css wp_enqueue_style( ‘animate-stylesheet’, get_stylesheet_directory_uri() . ‘/library/css/animate.css’, array(), ”, ‘all’ ); wp_enqueue_script( ‘wow-js’, get_stylesheet_directory_uri() . ‘/library/js/vendor/wow.min.js’, array(), ”, ‘all’ ); } add_action(‘wp_enqueue_scripts’, ‘theme_enqueue_scripts’ ); Then your initization script can be added to the wp_head hook. function … Read more

Ajax, jQuery and WordPress

Wrap your javascript code with document.ready, and if it works I would suggest going back to putting this in an external file jQuery(document).ready(function(){ jQuery(‘#ajax_form’).on(‘submit’, function(e) { e.preventDefault(); console.log(‘Here’); var form = jQuery(‘#ajax_form’); var data = form.serialize(); data.action = ‘add_word_to_form’ jQuery.post(‘/wp-admin/admin-ajax.php’, data, function(response) { alert(data); }); //return false; }); });

Custom field in external Javascript

I had a similar problem using custom field values in a widget that used JavaScript. I wrote a tutorial explaining it. Try this code: <?php global $post; $cf = get_post_meta($post->ID, ‘my_custom_field’, true); ?> <button onclick=”window.open(<?php echo json_encode($cf); ?>);”>Click me</button>

Help with my first Metabox helper class

The problem seems on the line no 279 of metabox class api definition, below is your code: ‘<img src=”‘.$label.'” class=”optionimg ‘.$selected_value.'” onclick=”document.getElementById(\ ”.$field[‘id’].$choices.’\’).checked=true” style=”display:inline-block;” /><input type=”radio” name=”%s” id=”%s” value=”%s” style=”display:none;”/>’, $choices is not defined variable in the scope (error thrown by WAMP), I think you should replace $field[‘id’].$choices with $value as in below code: ‘<img … Read more

Possible jquery / library conflict in plugin usage

The gallery plugin is loading it’s scripts before the jQuery migrate script which is being loaded by the jquery updater plugin <script type=”text/javascript” src=”http://www.riccardo.it/newtech/wp-content/plugins/jquery-updater/js/jquery-2.1.0.min.js?ver=2.1.0″></script> <script type=”text/javascript” src=”http://www.riccardo.it/newtech/wp-content/plugins/gallery-plugin/fancybox/jquery.mousewheel-3.0.4.pack.js?ver=3.5″></script> <script type=”text/javascript” src=”http://www.riccardo.it/newtech/wp-content/plugins/gallery-plugin/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.5″></script> <script type=”text/javascript” src=”http://www.riccardo.it/newtech/wp-content/plugins/jquery-updater/js/jquery-migrate-1.2.1.min.js?ver=1.2.1″></script> This is causing a JavaScript error which is preventing other scripts from running. Try disabling the jQuery updater plugin and let WordPress … Read more