<?php
/**
 * Kadence-Child functions and definitions
 *
 * @package Kadence-Child
 */

// Enqueue parent theme styles
function kadence_child_enqueue_styles() {
    wp_enqueue_style(
        'kadence-parent-style',
        get_template_directory_uri() . '/style.css'
    );
}
add_action( 'wp_enqueue_scripts', 'kadence_child_enqueue_styles' );

// Add your custom functions below this line

/**
 * Register custom Gutenberg blocks
 */
function kadence_child_register_blocks() {
    // PM Visual block (4 style variations: Hero Stack, Impact, Story, About)
    register_block_type( get_stylesheet_directory() . '/blocks/pm-visual' );

    // PM Section Label block
    register_block_type( get_stylesheet_directory() . '/blocks/pm-section-label' );

    // PM Faces block
    register_block_type( get_stylesheet_directory() . '/blocks/pm-faces' );
}
add_action( 'init', 'kadence_child_register_blocks' );

/* Enable auto-updates of plugins/themes on Flywheel */
add_action(
    'wp_update_plugins',
    function() {
        if (wp_doing_cron() && ! doing_action('wp_maybe_auto_update')) {
            do_action('wp_maybe_auto_update');
        }
    },
    20
);