Post title not saving

I think the problem lies here, $(‘.inside input’).on(‘click’, function() { if ($(this).is(‘:checked’)) { $(‘#title’).val(‘overview’); } else { $(‘#title’).val(title); } }); “.inside input” in your javascript code is checkbox? If yes then, it will also apply to publish button. So when you click publish button,above js will be called and will change the title. Use some … Read more

Absolutely print script in footer

Cannot be overwritten Cannot be removed/filtered This will be done by a plugin. These are mutually exclusive. Such a thing can’t be done by a plugin or by any other code from within WordPress. You would need to hook code in elsewhere, at the webserver or PHP level. You could use the PHP.INI directives of … Read more

Notification when left menu bar is closed?

How to get a notification via Javascript when the left menu bar has been collapsed ? If you are taking about the admin menu bar and you want to get a notification when the that is closed and expanded, then watch thoroughly that, when admin menu bar is collapsed, a folded class is added to … Read more

WordPress opens js files as a catalog. Path is right [closed]

You should solve your problem while moving toward a best practice while you’re at it by using wp_enqueue_script(). This will likely solve your issues because it’s domain agnostic. Start by moving your JS file(s) to a /js/ folder in your [child] theme or custom plugin. Then load your script like this… (snippets copied and adpated … Read more

TinyMCE Javascript URL Question

I think the best way is to use the before_wp_tiny_mce() hook. Then, you can define the url in PHP; and pass it to the page so it is available to TinyMCE. function sgp_before_wp_tiny_mce() { ?> <script type=”text/javscript”> var sgp_plugin_url = “<?php echo plugins_url(‘shortcode_generator_popup.php’, __FILE__); ?>”; </script> <?php } add_action(‘before_wp_tiny_mce’, ‘sgp_before_wp_tiny_mce’); You may need to change … Read more

Custom JS text area in customizer is being formatted wrong in document

@sam-skirrow just posting here what we did to fix this… WordPress 4.1 requires us to use a sanitize_callback filter when creating settings for the customizer (with good reason). Since you’re using the kirki framework to create these customizer settings, kirki detects that this is a textarea field and so it automatically applies the esc_textarea filter. … Read more

php variable inside javascript code

This should work: <?php $script = “<script type=”text/javascript”> jQuery( document ).ready( function($) { $(document).ready(function() { $(‘#particles’).particleground({ dotColor: ” . json_encode($dotcolor) . “, lineColor: ‘#5cb9bd’, }); }); } ); </script>”; ?> Note: Its a better practice to enqueue Javascripts with wp_enqueue_script() and include dynamic strings via wp_localize_script(). Docs: https://codex.wordpress.org/Function_Reference/wp_enqueue_script https://codex.wordpress.org/Function_Reference/wp_localize_script