/* ============================================================ THREE HILLS EVENTS — ADDITIONS ============================================================ */ // Enqueue our fonts + JS function the_three_hills_assets() { wp_enqueue_style( 'the-google-fonts', 'https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500&display=swap', [], null ); wp_enqueue_script( 'the-main-js', get_template_directory_uri() . '/js/the-main.js', [], '1.0', true ); wp_enqueue_script( 'the-enquiry-form', get_template_directory_uri() . '/js/the-enquiry-form.js', [], '1.0', true ); } add_action( 'wp_enqueue_scripts', 'the_three_hills_assets' ); // ACF Options page function the_three_hills_options() { if ( ! function_exists( 'acf_add_options_page' ) ) return; acf_add_options_page([ 'page_title' => 'Theme Settings', 'menu_title' => 'Theme Settings', 'menu_slug' => 'the-theme-settings', 'capability' => 'edit_theme_options', 'icon_url' => 'dashicons-admin-customizer', 'position' => 60, 'redirect' => false, ]); acf_add_options_sub_page([ 'page_title' => 'Header & Footer', 'menu_title' => 'Header & Footer', 'parent_slug' => 'the-theme-settings' ]); acf_add_options_sub_page([ 'page_title' => 'Contact Details', 'menu_title' => 'Contact Details', 'parent_slug' => 'the-theme-settings' ]); acf_add_options_sub_page([ 'page_title' => 'Social Media', 'menu_title' => 'Social Media', 'parent_slug' => 'the-theme-settings' ]); } add_action( 'acf/init', 'the_three_hills_options' ); // ACF JSON save/load add_filter( 'acf/settings/save_json', function() { return get_template_directory() . '/acf-json'; } ); add_filter( 'acf/settings/load_json', function( $paths ) { $paths[] = get_template_directory() . '/acf-json'; return $paths; } ); // Flexible content renderer function the_render_flexible_content( $field = 'page_sections' ) { if ( ! function_exists( 'have_rows' ) || ! have_rows( $field ) ) return; while ( have_rows( $field ) ) : the_row(); $layout = get_row_layout(); $tpl = get_template_directory() . '/the-template-parts/blocks/block-' . $layout . '.php'; if ( file_exists( $tpl ) ) include $tpl; endwhile; } // Helpers function the_option( $key, $fallback = '' ) { if ( function_exists( 'get_field' ) ) { $v = get_field( $key, 'option' ); return $v ?: $fallback; } return $fallback; } function the_stars( $n = 5 ) { $s = ''; return str_repeat( $s, absint( $n ) ); } function the_grid_cell( $image, $extra = '', $label = 'Add photo in ACF' ) { echo '
'; if ( $image ) echo '' . esc_attr( $image['alt'] ) . ''; else echo '
' . esc_html( $label ) . '
'; echo '
'; } // Header JS — sticky + mobile toggle via the-main.js uses IDs: the-header, the-nav-toggle, the-mobile-nav