Removing ‘woocommerce-no-js’ class from body
Removing ‘woocommerce-no-js’ class from body
Removing ‘woocommerce-no-js’ class from body
I don’t want Ajax request to be sent every 2 seconds. Is there a way to send me a notification only if the database changes in a certain meta? You can’t watch the database for changes like this. The most you could do is add filters on post meta changes on the PHP side to … Read more
Different behaviour between “include_once” and directly echoing out html code?
Jquery post responses 500 error after some time and lastly an 503 error
Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
If you only have one iframe, just set the iframe’s src attribute in the .show() callback function. <script type=”text/javascript”>//<![CDATA[ jQuery(window).load(function($){ setTimeout(function(){ $(‘.hidden_div’).show(function(){ $(this).find(‘iframe’).attr(‘src’, ‘https://example.com/’); }); }, 5000); });//]]> </script> If you need more dynamic code, remove the src attribute of the iframe, and add a new attribute with the url like so <iframe data-src=”https://example.com/”></iframe> And … Read more
You can not mix js and php. It seems (sure) that your js script (that was embed in the document), has php in it. That can work if the code is embed in the document as the php tags are open and close correctly. If you link to a js file, there is no way … Read more
Why are you not using the built-in enqueue_script function? Simply put your custom jQuery code into a file called custom.js, save it into your plugin or theme folder, then enqueue it with jQuery as a dependency: <?php function custom_scripts() { if (is_admin()){ wp_enqueue_script( ‘customjs’, get_template_directory_uri() . ‘/js/custom.js’, array(‘jquery’) ); } } add_action(‘wp_enqueue_scripts’, ‘custom_scripts’); You’ll need … Read more
Wrap the code like this to make it not conflict with other JS libraries wordpress loads. jQuery(document).ready(function($) { // code }); OR (function($) { // code })(jQuery);
Just paste this in your functions.php file. It will automatically add jQuery in your theme. function wcs_scripts_styles() { wp_enqueue_script( ‘jquery’ ); } add_action( ‘wp_enqueue_scripts’, ‘wcs_scripts_styles’ ); WordPress automatically include jquery from it’s location. You do not need to upload jquery on your theme. additionally you can also add more scripts lile this. function wcs_scripts_styles() { … Read more