Problem in loading javascript in footer
Try to add the code to the footer using add_action(‘wp_footer’, ‘front_js’, 99); where 99 specifies the order in which the functions are executed. Now it should be executed after your scripts are loaded.
Try to add the code to the footer using add_action(‘wp_footer’, ‘front_js’, 99); where 99 specifies the order in which the functions are executed. Now it should be executed after your scripts are loaded.
So, far the problem was with the initial loading of the JS file. As i couldn’t find any solution using the JS. The problem was not about the script loading rather then the execution timing. Anyways, The theme customizer looks into the global variable for which Panel/Section/Control it will show as active when it loads. … Read more
You should run updatepage() function after loading the google jsapi script. try jquery ready inside updatepage like this: function updatepage(){ // this line added by me jQuery(document).ready(function ($) { // Load the Visualization API and the piechart package. …. …. chart.draw(data, options); } } or you can see this shortcode code plugin for simple chart … Read more
I think your php add_to_cart function not setting cart cookies, you can do this manually by adding this line inside the if condition before //$added line add this line do_action( ‘woocommerce_set_cart_cookies’, TRUE ); this will set cart cookies.
Code:- function more_shortcode( $atts , $content = null ){ return ‘<div id=”more-outer-‘.$atts[‘id’].'”><a href=”#” id=”more-link-‘.$atts[‘id’].'”>More</a><div id=”more-inner”>’. $content .'</div></div>’; } add_shortcode( ‘more’, ‘more_shortcode’ ); Usage:- [more id=’1′]This is one.[/more] [more id=’2′]This is two.[/more] [more id=’3′]This is three.[/more] Output:- <div id=”more-outer-1″><a href=”#” id=”more-link-1″>More</a><div id=”more-inner”>This is one.</div></div> <div id=”more-outer-2″><a href=”#” id=”more-link-2″>More</a><div id=”more-inner”>This is two.</div></div> <div id=”more-outer-3″><a href=”#” id=”more-link-3″>More</a><div id=”more-inner”>This … Read more
PHP wp_enqueue_scripts is a good time to localize the data. Make sure you target your script and create a name for the object as well as passing an array of data. In this case twitter_settings is the object that will be created and will hold all the data. twitter_settings.tweets_widget_id will ultimately hold your $tweet. add_action( … Read more
I used this to show images on slider .Try this <div class=”col-md-12″> <div class=”carousel carousel-showmanymoveone slide” id=”carousel123″> <div class=”carousel-inner”> <div class=”item active”> <div class=”col-xs-12 col-sm-6 col-md-3″> <img src=”https://wordpress.stackexchange.com/questions/217614/<?php echo plugin_dir_url( __FILE__ ) .”img/download-1.jpg’; ?>”></div> </div> <div class=”item”> <div class=”col-xs-12 col-sm-6 col-md-3″> <img src=”https://wordpress.stackexchange.com/questions/217614/<?php echo plugin_dir_url( __FILE__ ) .”img/download-1.jpg’; ?>”></div> </div> <div class=”item”> <div class=”col-xs-12 col-sm-6 … Read more
how to write a WP_Query that returns the custom field data This is not typically necessary. You can simply access meta data for each post in query individually (as you do already). You can also iterate through query more than once in a page (it rewinds to start automatically, that’s what while( have_posts() ) part … Read more
Untested but gosh darn it might just work… javascript file: jQuery( document ).ready(function() { jQuery.ajax({ url: // !! hardcode the URL of WP admin-ajax.php here, since you don’t want to use wp_localize_script() to pass it in… type: ‘POST’, data:{ action: ‘some_action’, // this is the function (via wp_ajax_ hook) that will be triggered }, success: … Read more
Did it with the window.wp.customize.bind() method. Hope this helps someone else.