WP-Cufon adding extra space in my paragraphs in Firefox and Chrome
I think this is more a Cufon problem than a WordPress one, you should check out the documentation and support at Cufon.
I think this is more a Cufon problem than a WordPress one, you should check out the documentation and support at Cufon.
jQuery is regular javascript. It is a js library, meaning nothing but that it is a collection of js functions in an object. Hence, going with your terminology, yes, it can be mixed. That being said, calling jQuery.noConflict(); is superfluous, since the library supplied by wordpress is loaded in noConflict mode anyway. If something inside … Read more
WordPress has a nice function mainly for that wp_localize_script To use it first queue your script: wp_enqueue_script( ‘My_Script_handle’, ‘path/to/script.js’ ); then create an array of strings you want to localize: $data = array( ‘exit’ => __( ‘Exit’,’my-plugin-domain’ ), ‘open’ => __( ‘Open’,’my-plugin-domain’ ), ‘close’ => __( ‘Close’,’my-plugin-domain’ ), ‘next’ => __( ‘Next’,’my-plugin-domain’ ), ‘previous’ => … Read more
You can add your own AJAX API for do_shortcode. Add this to a suitable location (i.e. functions.php or a plugin): add_action(‘wp_ajax_doshortcode’, ‘ajax_doshortcode’); function doshortcode() { echo do_shortcode($_POST[‘text’]); die(); // this is required to return a proper result } And this to your Javascript: $.ajax({ url : ajaxurl, data : { action : ‘doshortcode’, text : … Read more
Check out this tutorial by kaiser and go step by step: Every time I register a script and add jquery as dependency, it gets added to the <head> in the finally rendered HTML page. As this blocks page rendering time – the included script might modify the DOM – I want to add it to … Read more
You asked the question a long ago but I was looking for something similar and found a solution. Enqueue an admin side script on post edit screens(where we have tinyMCE). Then use the code below: (function($) { ‘use strict’; $(document).ready(function() { $(document).on( ‘click’, ‘#mce-modal-block’, function() { tinyMCE.activeEditor.windowManager.close(); }); }); })(jQuery); This way you can close … Read more
Here’s a Step by Step Guide to adding Javascript into Pages: Step 1: Log into WordPress Step 2: Navigate to whichever page you want to add the scripts onto. Step 3a: If you have some kind of Page Builder you’ll need to click the “Basic Editor” button or something similar so you get the Default … Read more
As @N00b mentioned Yes, it is safe adding a JS script as long as it doesn’t include any sensitive information. JS is fully exposed to client, you shouldn’t do it anyway. But your situtaion it is better to create a site specific custom plugin and add JS using it. Example : function themeslug_enqueue_style() { wp_enqueue_style( … Read more
First of all you should read the codex on AJAX_in_Plugins Secondly you should look at wp_localize_script to get the value for the admin-ajax url to your javascript. $data = array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ) ); wp_localize_script( ‘ajax-script’, ‘ajax_object’, $data ); In your javascript, you are then meant to reference the localized data jQuery(“.selectbox”).change(function(){ var … Read more
Does WordPress ship any polyfills of its own for the global environment? No, as far as I remember WP core doesn’t ship with any polyfills. What are best practices around handling/shipping polyfills in WordPress plugins? The typical practice for JS in public WP extensions is to either: stick with core–provided scripts/environment; isolate your code and … Read more