Retrieve URL of Script/Style and Dependencies

wp_enqueue_script() and wp_enqueue_style() both use WP_Dependencies::add() which initializes a new instance of _WP_Dependency (see wp_scripts() and wp_styles()), so all the script’s dependencies are stored in the deps property of the class instance. However, that property only stores the handle names of the script’s dependencies, e.g. jquery-migrate and jquery-core for the default/core jQuery script (handle name: … Read more

Adding tawk.to code just before body tag on functions.php file

You can the code to head or before body tag this way. Add this code at the last of functions.php add_action( ‘wp_head’, function() { ?> <!–Start of Tawk.to Script–> <script type=”text/javascript”> var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date(); (function(){ var s1=document.createElement(“script”),s0=document.getElementsByTagName(“script”)[0]; s1.async=true; s1.src=”https://embed.tawk.to/5b54359ee21878736ba23110/default”; s1.charset=”UTF-8″; s1.setAttribute(‘crossorigin’,’*’); s0.parentNode.insertBefore(s1,s0); })(); </script> <?php } ); Hope it helps

wp_add_inline_script not adding when script_loader_tag filtered

The reason this is happening is because the markup that is filtered by script_loader_tag includes the inline scripts. So when you filter it and replace all the HTML tag for a particular script, your filter is removing those inline script tags. If you print out the original value of $tag from within your filter you … Read more

Can the index.asset.php file be used with the enqueue_block_editor_assets action?

Yes you can use the index.asset.php file in the ‘enqueue_block_editor_assets’ action. I guess you missed to npm install the dependencies you want to use and import them in your script. That’s how @wordpress/scripts generates your asset.php file. If you do not import the dependencies in your JavaScript files the dependency management of asset.php wont work. … Read more

Enqueue Style for a page/pages only

It should work like this. Sidenotes: I don’t know why you deregister a stylesheet and register it again. Also: get_bloginfo(‘template_directory’) is now replaced by get_template_directory_uri(). Third: Are your folders really named with dots in between? Maybe this causes problems. And maybe your ui stylesheet is an dependency of the main jquery ui stylesheet. You should … Read more

Execute script only on certain admin pages

You can use this in your functions.php : function add_admin_scripts( $hook ) { if ( $hook == ‘post-new.php’ ) { wp_enqueue_script( ‘myscript’, get_bloginfo(‘template_directory’).’/js/myscript.js’ ); } } add_action(‘admin_enqueue_scripts’,’add_admin_scripts’,10,1);

enqueue the scripts

Add your script to a file inside your Theme root, e.g. /js/my-script-name.js. In functions.php, put add a function to enqueue your script: function mytheme_enqueue_some_script() { if ( ! is_admin() ) { $scriptsrc = get_template_directory_uri() . ‘/js/my-script-name.js’; wp_register_script( ‘my-script-name’, $scriptsrc ); wp_enqueue_script( ‘my-script-name’ ); } } Then, hook that function into the wp_enqueue_scripts hook: add_action( ‘wp_enqueue_scripts’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)