How to make a script load after Custom Block is loaded in the editor?

I couldn’t find a built in ACF way of doing this. Instead, in my block’s PHP render function I added printf( “<script>window.jQuery(window).trigger(‘acf/loaded/block-name’);</script>” ); This uses jQuery as an event bus to trigger an event when the block is rendered. You might need to include a check that you’re in the admin so the event won’t … Read more

Disable Visible Edit Shortcuts in the Customizer

The simplest way to disable edit shortcuts without unwanted side effects is to no-op override the JS function that generates them in the first place. You can do this from PHP as follows: add_action( ‘wp_enqueue_scripts’, function () { $js=”wp.customize.selectiveRefresh.Partial.prototype.createEditShortcutForPlacement = function() {};”; wp_add_inline_script( ‘customize-selective-refresh’, $js ); } ); This will work for any theme.

How to get current_cat in navbar, in single post

I found the answer here. Add to functions.php the following function and hook: function sgr_show_current_cat_on_single($output) { global $post; if( is_single() ) { $categories = wp_get_post_categories($post->ID); foreach( $categories as $catid ) { $cat = get_category($catid); // Find cat-item-ID in the string if(preg_match(‘#cat-item-‘ . $cat->cat_ID . ‘#’, $output)) { $output = str_replace(‘cat-item-‘.$cat->cat_ID, ‘cat-item-‘.$cat->cat_ID . ‘ current-cat’, $output); … Read more

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