How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?

You could use the gettext filter. See the examples here https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext. In your filter you will add code to check IF it’s the exact text you want to change then if the users meta value is what you are looking for the return the revised text. Else return the passed text unchanged.

How to add plugin with jQuery to custom theme?

It should be said, that WordPress comes with jQuery out-of-the-box. You can check it, if you slap this in your page-template (based on this post): window.onload = function() { if (window.jQuery) { // jQuery is loaded alert(“Yeah!”); } else { // jQuery is not loaded alert(“Doesn’t Work”); } } In case you need other scripts, … Read more

underscore template dynamically remove row Jquery

This isn’t WP related but Its not working because you are trying to add an event to a dynamically created element. Replace… jQuery( ‘.remove_field’ ).on(“click”, function(e){ e.preventDefault(); jQuery(this).parent(‘div’).remove(); }); With jQuery( ‘body’ ).on(“click”, ‘.remove_field’, function(e){ e.preventDefault(); jQuery(this).parent(‘div’).remove(); }); You can read more about your issue here.

Accessing javascript in multiple files [closed]

You have to create a dependency with wp_register_script($handle, $src, $dependency, $version, true/false); See WP codex: wp_register_script and then make sure that the second file is loaded correctly and right after the initial script. The third parameter is an array for dependencies/other “handles”. So..in your case: <?php // Functions.php or somewhere else wp_register_script(‘my_first_script’,get_template_directory_uri().’/js/my-first-script.js’, array(‘jQuery’), ‘1.0’, true); … Read more

How to keep HTML form field that is conditional hidden with javasript hidden after page reload?

Try this code: // Conditionally show price (function ($) { window.onload = function() { if ($(“#select_price_option”).val() == “I need more information”) { $(‘#price_input_div’).hide(); } $(“#select_price_option”).change(function() { if ($(this).val() == “I need more information”) { $(‘#price_input_div’).hide(); } else { $(‘#price_input_div’).show(); } }); }})(jQuery);

Convert UL to dropdown list not working

@CharlieJustUs when you use Fiddle is automatically sets the $ variable for you. When your script tries to run on your site, that variable is not set, and it fails. Try this please. jQuery(document).ready(function($) { $(function() { $(‘ul.clearfix’).each(function() { var $select = $(‘<select class=”dropdown-toggle” />’); $(this).find(‘a’).each(function() { var $option = $(‘<option />’); $option.attr(‘value’, $(this).attr(‘href’)).html($(this).html()); $select.append($option); … Read more

How do I use jQuery to add the TinyMCE WYSIWYG editor to a textarea?

I would just use the WordPress JavaScript API for TinyMCE — wp.editor. The steps in brief: PHP: Enqueue the editor scripts (and styles) via wp_enqueue_editor(). JS: Call wp.editor.initialize() from your script. And do take note of this: (the “this function” refers to wp.editor.initialize) If this function does nothing, please make sure that wp.editor.getDefaultSettings is a … Read more

Adding JavaScript file in Admin Panel

Yes, your code is good. And that my_custom_script is a unique identifier for the script you’re enqueueing. You can find the default script handlers/identifiers here — e.g. jquery for the jQuery library that ships with WordPress. There you can also find more details about the wp_enqueue_script() function, e.g. where should you use the function, the … Read more

Disable Cloudflare Rocket Loader for jQuery javascript and make it load first

jQuery is loaded by WordPress with wp_enqueue_script. The problem is WordPress also use the below code to change the handle public function localize( $handle, $object_name, $l10n ) { if ( ‘jquery’ === $handle ) { $handle=”jquery-core”; } The solution is to use the function function wpse_script_loader_tag( $tag, $handle ) { if ( ‘jquery-core’ !== $handle … Read more