__( 'Primary Menu', 'hogelandlinux' ), 'footer' => __( 'Footer Menu', 'hogelandlinux' ), ) ); } } add_action( 'after_setup_theme', 'hogelandlinux_setup' ); /** * Enqueue scripts and styles. */ function hogelandlinux_scripts() { wp_enqueue_style( 'hogelandlinux-style', HOGELANDLINUX_URL . '/assets/css/style.css', array(), HOGELANDLINUX_VERSION ); wp_enqueue_style( 'hogelandlinux-patterns', HOGELANDLINUX_URL . '/assets/css/patterns.css', array( 'hogelandlinux-style' ), HOGELANDLINUX_VERSION ); wp_enqueue_script( 'hogelandlinux-navigation', HOGELANDLINUX_URL . '/assets/js/main.js', array(), HOGELANDLINUX_VERSION, true ); } add_action( 'wp_enqueue_scripts', 'hogelandlinux_scripts' ); /** * Business info used across the site (matches the original static site). * All values can be overridden on the Settings > General screen. */ function hogelandlinux_business() { return array( 'name' => get_bloginfo( 'name' ), 'kvk' => get_option( 'hl_kvk', '91927935' ), 'email' => get_option( 'hl_email', get_option( 'admin_email', 'info@chemistry.software' ) ), 'street' => get_option( 'hl_street', 'Voorstraat 123' ), 'postal' => get_option( 'hl_postal', '9967 AA' ), 'village' => get_option( 'hl_village', 'Eenrum' ), 'domain' => wp_parse_url( home_url(), PHP_URL_HOST ), ); } /** * Determine which page slug should be considered "active route" for the menu. */ function hogelandlinux_current_key() { if ( is_front_page() ) { return 'home'; } if ( is_home() ) { return 'blog'; } $obj = get_queried_object(); if ( $obj && isset( $obj->post_name ) ) { return $obj->post_name; } return home_url(); } /** * Render the primary nav. Uses a registered WordPress menu when one is set, * otherwise falls back to listing published top-level pages (so any new page * automatically appears in the menu). */ function hogelandlinux_nav( $location = 'primary' ) { $locations = get_nav_menu_locations(); if ( ! empty( $locations[ $location ] ) ) { wp_nav_menu( array( 'theme_location' => $location, 'container' => false, 'menu_class' => 'nav-links', 'items_wrap' => '', 'fallback_cb' => false, ) ); return; } if ( 'footer' === $location ) { return; } // Fallback: list pages automatically. $pages = get_pages( array( 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'exclude' => get_option( 'page_on_front' ) ? array( (int) get_option( 'page_on_front' ) ) : array(), ) ); if ( empty( $pages ) ) { return; } echo ''; } /** * Fallback for the mobile menu: same pages as primary, or registered menu. */ function hogelandlinux_nav_mobile() { $locations = get_nav_menu_locations(); if ( ! empty( $locations['primary'] ) ) { wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false, 'menu_class' => '', 'items_wrap' => '%3$s', 'fallback_cb' => false, ) ); return; } $pages = get_pages( array( 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'exclude' => get_option( 'page_on_front' ) ? array( (int) get_option( 'page_on_front' ) ) : array(), ) ); if ( empty( $pages ) ) { return; } foreach ( $pages as $page ) { $current = ( hogelandlinux_current_key() === $page->post_name ) ? ' active' : ''; printf( '%s', esc_url( get_permalink( $page ) ), esc_attr( trim( $current ) ), esc_html( get_the_title( $page ) ) ); } } /** * Shortcode: a generic hero banner. * * [hero title="..." subtitle="..." button_text="..." button_url="..."] * [hero button_secondary_text="..." button_secondary_url="..."] */ function hogelandlinux_shortcode_hero( $atts ) { $atts = shortcode_atts( array( 'title' => '', 'subtitle' => '', 'button_text' => '', 'button_url' => '', 'button2_text' => '', 'button2_url' => '', 'large' => 'no', ), $atts, 'hero' ); ob_start(); ?>

'', 'class' => 'section--light', ), $atts, 'section' ); $title = $atts['title'] ? '

' . esc_html( $atts['title'] ) . '

' : ''; return '
' . $title . do_shortcode( $content ) . '
'; } add_shortcode( 'section', 'hogelandlinux_shortcode_section' ); /** * Shortcode: a single card. * [card title="..." class="card--benefit" icon="🛡️"]Body content[/card] */ function hogelandlinux_shortcode_card( $atts, $content = null ) { $atts = shortcode_atts( array( 'title' => '', 'class' => 'card--service', 'icon' => '', 'link' => '', ), $atts, 'card' ); $inner = ''; if ( $atts['icon'] ) { $inner .= '
' . $atts['icon'] . '
'; } if ( $atts['title'] ) { $inner .= '

' . esc_html( $atts['title'] ) . '

'; } $inner .= do_shortcode( $content ); $class = 'card ' . esc_attr( $atts['class'] ); if ( $atts['link'] ) { return '' . $inner . ''; } return '
' . $inner . '
'; } add_shortcode( 'card', 'hogelandlinux_shortcode_card' ); /** * Shortcode: a responsive grid. * [grid cols="benefits|services|distros|2|3"] content [/grid] */ function hogelandlinux_shortcode_grid( $atts, $content = null ) { $atts = shortcode_atts( array( 'cols' => 'services', ), $atts, 'grid' ); $map = array( 'benefits' => 'benefits-grid', 'services' => 'services-grid', 'distros' => 'distros-grid', 'features' => 'features-grid', 'steps' => 'steps-grid', '2' => 'grid grid--2-col', '3' => 'grid grid--3-col', ); $class = isset( $map[ $atts['cols'] ] ) ? $map[ $atts['cols'] ] : 'grid'; return '
' . do_shortcode( $content ) . '
'; } add_shortcode( 'grid', 'hogelandlinux_shortcode_grid' ); /** * Shortcode: a call-to-action section. * [cta title="..." text="..." button_text="..." button_url="..."] */ function hogelandlinux_shortcode_cta( $atts ) { $atts = shortcode_atts( array( 'title' => '', 'text' => '', 'button_text' => '', 'button_url' => '', ), $atts, 'cta' ); ob_start(); ?>

'', 'number' => '', 'label' => '', ), $atts, 'stat' ); return '
' . $atts['icon'] . '

' . esc_html( $atts['number'] ) . '

' . esc_html( $atts['label'] ) . '

'; } add_shortcode( 'stat', 'hogelandlinux_shortcode_stat' ); /** * Shortcode: a collapsible disclaimer. * [disclaimer summary="Lees de back-updisclaimer"]Body[/disclaimer] */ function hogelandlinux_shortcode_disclaimer( $atts, $content = null ) { $atts = shortcode_atts( array( 'summary' => '', ), $atts, 'disclaimer' ); return '
' . esc_html( $atts['summary'] ) . '
' . do_shortcode( $content ) . '
'; } add_shortcode( 'disclaimer', 'hogelandlinux_shortcode_disclaimer' ); /** * Register custom button block styles. */ function hogelandlinux_register_block_styles() { register_block_style( 'core/button', array( 'name' => 'hl-primary', 'label' => __( 'Hogeland Primary', 'hogelandlinux' ), ) ); register_block_style( 'core/button', array( 'name' => 'hl-secondary', 'label' => __( 'Hogeland Secondary', 'hogelandlinux' ), ) ); register_block_style( 'core/button', array( 'name' => 'hl-on-dark', 'label' => __( 'Hogeland On Dark', 'hogelandlinux' ), ) ); } add_action( 'init', 'hogelandlinux_register_block_styles' ); /** * Block patterns (Gutenberg). */ require HOGELANDLINUX_PATH . '/inc/block-patterns.php';