<?php
/**
 * Kadence Child theme functions.
 *
 * @package kadence-child
 */

defined( 'ABSPATH' ) || exit;

/**
 * Enqueue the parent and child stylesheets.
 */
function kadence_child_enqueue_styles() {
	wp_enqueue_style(
		'kadence-child',
		get_stylesheet_directory_uri() . '/style.css',
		array( 'kadence-global' ),
		wp_get_theme()->get( 'Version' )
	);
}
add_action( 'wp_enqueue_scripts', 'kadence_child_enqueue_styles', 20 );

/**
 * Point ACF Local JSON at this theme.
 *
 * Field groups sync to kadence-child/acf-json/ so they live in the codebase
 * rather than only in the database. This replaces the save/load filters that the
 * old League Law Custom Features plugin used to provide, which pointed at a
 * directory that was empty.
 */
add_filter(
	'acf/settings/save_json',
	function () {
		return get_stylesheet_directory() . '/acf-json';
	}
);

add_filter(
	'acf/settings/load_json',
	function ( $paths ) {
		unset( $paths[0] );
		$paths[] = get_stylesheet_directory() . '/acf-json';
		return $paths;
	}
);

require_once get_stylesheet_directory() . '/includes/post-types.php';
