Tag Info

New answers tagged

2

The reason this probably doesn't work is because Wordpress uses noConflict() mode. From The Codex: The jQuery library included with WordPress is set to the noConflict() mode ( see wp-includes/js/jquery/jquery.js ). This is to prevent compatibility problems with other JavaScript libraries that WordPress can link. In the noConflict() mode, the global ...


2

Bad news first: We can't fix your JS problem (at least as long as the errors come from the jQuery UI version shipped with core and not from your custom definitions). This is a WordPress core problem. When you look at the SVN trunk, especially the main (and only) PHP file in that folder, you will see that the plugin doesn't even ship with any script... at ...


0

With help from a colleague, we dug through class-wp-editor.php Here are the necessary scripts to initialise jQuery tinyMCE if wp_editor has not been used beforehand (which calls these scripts). // Get the necessary scripts to launch tinymce $baseurl = includes_url( 'js/tinymce' ); $cssurl = includes_url('css/'); global $tinymce_version, ...


0

You need specify jquery as a dependency of your custom script, setting the 3rd parameter of wp_enqueue_script() to array('jquery'), like this: wp_enqueue_script( 'yourCustomScript', plugins_url('js/yourCustomScript.js', __FILE__), array('jquery'), '1.0.0', false ); Change the path to point to your custom-script file As to your last ...


0

You might want to take a look at CRED plugin and see if it gets you anywhere near what you need. I've worked with it back when it was three different plugins (Types, Views and Access). For as much as I can remember they used to keep a testing environment where you could take plugins for a spin in a clean site on their server before you bought it, you ...


0

Maybe this plugin comes close to what you want? https://wordpress.org/plugins/adminer/screenshots/ However, you can use something like Sequel Pro to connect to the database to build SQL queries.


3

You don't have to specifically enqueue jQuery, as you're probably using jQuery in your custom script. You can do: wp_enqueue_script( 'my-script', plugin_url( 'js/my-script.js', __FILE__ ), array('jquery') ); jQuery(document).ready(function($){ //Do anything... }); Notice the $ passed as an arg to the callback, it will make jQuery accessible to your ...


0

Here is my view: Load it inside your single.php why use ajax at all? Google wont be able to see this (using must crawlers). In any case - here is the right way to return the data... please note that you can use get_post or wp_query. up tp you. JS Part: jQuery(document).ready(function($) { $.post(ajax_object.ajaxurl, { action: ...


-3

Simply follow these steps, in my case my plugin name is awesome social icons. // Step - 1 <?php function register_awesome_social_submenu_page() { add_submenu_page('options-general.php', 'Awesome Social', 'Awesome Social', 'manage_options', 'awesome-social', 'awesome_social_callback'); } ?> // Step - 2 <?php ...


-1

You need to make sure jQuery has been loaded, so output your code in a late action, eg for front end you could use 'wp_print_footer_scripts' with a large priority: add_action( 'wp_print_footer_scripts', function () { ?> <script> jQuery(document).ready(function(){ //Do anything... }); </script> <?php }, 50 ); ...


-3

use Nextgen Gallery plugin to enable image management at its best. You can create album, galleries, set watermarks and more. With this you can create image galleries with the template option given within.


1

Add data-post_id attribute to checkbox and fill it with corresponding post ID. On click on compare button (link) retrieve all post ids from checked checkboxes with JavaScript (jQuery) Redirect to the comparision page with post IDs in url as GET parameters. This is just one scenario how you task could be done. PS your question is not related to WordPress ...


0

Use WordPress Ajax API for any kind of ajax related stuff. For more details : http://codex.wordpress.org/AJAX_in_Plugins


0

You have been answered in stackoverflow in the following way: <div id="tab-one" style="display: none">Tab1 info 1 content</div> <div id="tab-two" style="display: none">Tab1 info 2 content</div> <div id="tab-three" style="display: none">Tab1 info 3 content</div> <ul class="side bar tabs"> <li ...


0

FWIW... It APPEARS to have been a misconfiguration in the PHP.INI on a new Development Server (WAMP), which resulted in an unknown corruption of the code upon updating from wp4.0 to 4.1 such that PHP was injecting unwanted white space e.g. "\r\n\r\n..." in my AJAX responses (like a missing closing php ?> tag or someting?) When running ob_clean() before ...


0

The correct way to do this is to: $('#upload-background-image-one').click(function() { formfield = $('#background-size-one').attr('name'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); // Take the selected image and insert only the src path into the text field. window.send_to_editor = function(html) { ...


0

The reason you cannot use this by default is because of no conflict. From the Codex: The jQuery library included with WordPress is set to the noConflict() mode (see wp-includes/js/jquery/jquery.js). This is to prevent compatibility problems with other JavaScript libraries that WordPress can link. In the noConflict() mode, the global $ shortcut for ...


2

I have been investing some quality time (and headaches) with WP ajax so I understand where you are coming from. In all honesty, it could be anything from an error in your JS code or something completely bizarre, like: add_action('wp_ajax_UpdateMeta', 'UpdateMeta'); Should be changed to: add_action('wp_ajax_updatemeta', 'UpdateMeta'); ... to remove ...


1

You have to use the admin-ajax handler to do the AJAX call. Replace file.php in var url = "file.php"; with yoursite.com/wp-admin/admin-ajax.php?action=simple_ajax And in your plugin / functions.php file, add add_action('wp_ajax_nopriv_simple_ajax','process_simple_ajax' //for non logged in user add_action('wp_ajax_simple_ajax','process_simple_ajax' //for ...


3

I'm surprised it's all that slow but you can remove all but one of the database calls & most of the looping by passing the term data instead of just slugs to my_dropdown_categories() so get_terms() doesn't have to be called, plus a few other improvements (see comments) eg: function my_dropdown_categories( $taxonomy, $current_selected = '', $terms = ...


0

If, as you have ensured, the javascript files are correctly loaded, simply WordPress is not likely to be involved in your problem. That being said, if, as you also have ensured, the code is correct and there are no errors, I think that the problem can be related with the DOM being not ready. The code from java1.js code depends on DOM, so you must be sure ...


1

The difference between the code you linked and your version, is that your post link has the permalink as the href value, where the original has just a hash. When you add a click handler to an anchor tag, it doesn't prevent what normally occurs when you click that link, it just executes the javascript and normal link behavior continues as it otherwise would. ...


1

Updating the url via javascript, is not related to WordPress, however you just need to modify window.location.hash in your jQuery code. Regarding the usage of admin-ajax.php it is recommended way to do tasks via AJAX that need to load WordPress environment, instead of manually requiring wp-load.php. In your case you are sending a request to a regular ...


0

The below code solves this problem: metabox.js code: jQuery(function($) { function my_check_categories() { $('#my-meta-box').hide(); // intially hides the metabox /* script to show metabox on category ids 2,3 and 4 (write the category ids in the if condition below on line 14)*/ $('#event-categorieschecklist ...


1

To do that you will first have to deregister your jQuery script and then register again. If you use jQuery comes with WordPress then following is the function your are looking for. function starter_scripts() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true ); ...


-1

By default wp_enqueue_script add scripts to header, unless you specify it to be the footer by adding true boolian value at the end of the function call. Like this /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); ...


0

Hey only change your code to like this function starter_scripts() { wp_enqueue_style( 'starter-style', get_stylesheet_uri() ); wp_enqueue_script('jquery'); wp_enqueue_script( 'includes', get_template_directory_uri() . '/js/min/includes.min.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'starter_scripts' ); i ...


0

Oh for f*ck's sake. In my custom widgets, I had omitted adding the ID to 'before_widget' markup, as I wasn't using the IDs for styling. Turns out this is what the Customizer JS is using to target the widgets. (duh) So, including the proper ID in the widget output makes everything work as it should.


2

You are not enqueueing your custom JavaScript file. And calling the var (templateUrl) in JS file without the handle. Follow the following: I'm enqueueing my custom JavaScripts file (script.js) under the dependency of jQuery, so it will enqueue jQuery library from core. And I'm using the same handle my-custom-js for both my script and localize_script to pass ...



Top 50 recent answers are included