Override theme style rule in Gutenberg

.entry-content a:hover is more specific than .wp-block-button__link:hover. According to the rules of specificity, the first selector contains 2 class selectors (.entry-content and :hover), and 1 type selector (a), for a specificity score of 0,0,2,1. The second selector, on the other hand, contains 2 class selectors (.wp-block-button__link and :hover), and no type selectors, for a score … Read more

WordPress 5.1 upgrade has lost the parent theme JavaScript

I traced this back to the name of the scripts.js JavaScript file. My parent theme (BeTheme) enqueues the main scripts.js like this: wp_enqueue_script(‘mfn-scripts’, get_theme_file_uri(‘/js/scripts.js’), array(‘jquery’), MFN_THEME_VERSION, true); In my child theme crmpiccodotcom/footer.php I enqueue the scripts.js like this: // include the crmpiccodotcom child theme JavaScript add_action(‘wp_enqueue_scripts’, ‘crmpiccodotcom_enqueue_scripts’); function crmpiccodotcom_enqueue_scripts() { wp_enqueue_script( ‘custom-script’, CHILD_THEME_URI. ‘/js/scripts.js’, array(‘jquery’) … Read more

How do I activate a certain block template only when editing the front page?

Setting $post_type_object->template seems to be done on ‘init’ (or close to it) while is_front_page() is set later, so I had to use $_GET[‘post’] instead. I also changed get_post_type_object( ‘post’ ) to ‘page’. Like this: add_action( ‘init’, ‘home_block_template’ ); function home_block_template() { if ( ! is_admin() || ! isset( $_GET[‘post’] ) || get_option( ‘page_on_front’ ) !== … Read more

How to import Reusable Blocks programatically?

The easiest solution so far seems to be creating the Reusable Blocks as custom post types: wp_insert_post([ ‘post_content’ => ‘<!– wp:shortcode –> [slider] <!– /wp:shortcode –>’, ‘post_title’ => ‘My Slider’, ‘post_type’ => ‘wp_block’, ‘post_status’ => ‘publish’, ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’, ‘guid’ => sprintf( ‘%s/wp_block/%s’, site_url(), sanitize_title(‘my-slider’) ) ]); This way, I can create … Read more

Getting ACF Field in Page – From the Footer

I have the same issue, the acf get_field() function in footer returned null. Native WP function get_post_meta( get_the_ID(), ‘option_key’, true ) didn’t work to. But when I’ve noticed that get_the_ID() function in footer returned the wrong value because I forgot to reset query after custom WP_Query. So, reset custom WP_Query (wp_reset_query()) or hard code the … Read more