Enqueue Script in WordPress

Your first snippet sets $in_footer to false so the the script will be added to the <head /> of your document. The second snippet sets $in_footer to true and so it will be added at the bottom of your document (usually just before </body>, but it depends on where wp_footer() is called in your theme). … Read more

Adding Pinterest Script Before Closing Body Tag

Yes, you have to use wp_enqueue_script function. Pass $in_footer argument as true and your script will be added before closing body: function my_scripts_method() { wp_enqueue_script( ‘pinterest’, ‘//assets.pinterest.com/js/pinit.js’, array(), false, true); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ );

include jquery plugin file not working

Your uses of wp_register_script and add_action are incorrect. Try the following code: function you_fancy_js(){ wp_register_script( ‘custom-script’, plugins_url( ‘/js/jquery.js’, __FILE__ ), array( ‘jquery’, ‘jquery-ui-core’, ‘jquery-validate’ ) ); wp_enqueue_script( ‘custom-script’ ); } add_action(‘wp_enqueue_scripts’,’you_fancy_js’); This assumes that your custom jQuery functions are in jquery.js and jquery, jquery-ui-core, and jquery-validate are already enqueued. You do not need admin_head. The … Read more

How to use wp_enqueue_script, style when required

You can create a shortcode: function load_scripts() { wp_enqueue_script(‘moder’); wp_enqueue_style(‘styles’); } add_shortcode(‘load_scripts’, ‘load_scripts’); Then use the shortcode to enqueue the scripts/styles: [load_scripts] Or so: do_shortcode(‘[load_scripts]’); In terms of running when required, you have to make sure that if you’re loading something that requires these, that you either execute the shortcode or enqueue those scripts/styles, since … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)