__( '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_script( 'hogelandlinux-navigation', HOGELANDLINUX_URL . '/assets/js/main.js', array(), HOGELANDLINUX_VERSION, true ); } add_action( 'wp_enqueue_scripts', 'hogelandlinux_scripts' ); /** * Helper: current page name, used to highlight the active nav item. */ function hogelandlinux_current_page() { if ( is_front_page() ) { return 'home'; } $page = get_queried_object(); if ( $page && isset( $page->post_name ) ) { $name = $page->post_name; } else { $name = wp_basename( (string) wp_parse_url( home_url( $GLOBALS['wp']->request ?? '' ), PHP_URL_PATH ) ); } return $name ? $name : 'home'; } /** * Render a nav link with the active class applied. */ function hogelandlinux_nav_link( $label, $path, $key ) { $current = hogelandlinux_current_page(); $class = ( $current === $key ) ? ' class="active"' : ''; printf( '%s', esc_url( home_url( $path ) ), $class, esc_html( $label ) ); } /** * Business info used across the template (matches the original static site). */ function hogelandlinux_business() { return array( 'name' => get_bloginfo( 'name' ), 'kvk' => '91927935', 'email' => 'info@chemistry.software', 'street' => 'Voorstraat 123', 'postal' => '9967 AA', 'village' => 'Eenrum', 'domain' => wp_parse_url( home_url(), PHP_URL_HOST ), 'about' => 'Bdnugget', 'birth' => '1990-01-01', 'son_birth' => '2022-01-01', ); } /** * Age helper, mirrors the Go site's age calculation. */ function hogelandlinux_age( $birth ) { $birth = DateTime::createFromFormat( 'Y-m-d', $birth ); if ( ! $birth ) { return 0; } $now = new DateTime(); $age = $now->diff( $birth )->y; return $age; } /** * Excerpt size for pages used on the front page. */ function hogelandlinux_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'hogelandlinux_excerpt_length' );