__( '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(); ?>' . esc_html( $atts['label'] ) . '