lol vibe
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* HogelandLinux theme functions and definitions.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'HOGELANDLINUX_VERSION', '1.0.0' );
|
||||
define( 'HOGELANDLINUX_URL', get_template_directory_uri() );
|
||||
define( 'HOGELANDLINUX_PATH', get_template_directory() );
|
||||
|
||||
if ( ! function_exists( 'hogelandlinux_setup' ) ) {
|
||||
function hogelandlinux_setup() {
|
||||
load_theme_textdomain( 'hogelandlinux', HOGELANDLINUX_PATH . '/languages' );
|
||||
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
add_theme_support(
|
||||
'html5',
|
||||
array(
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script',
|
||||
)
|
||||
);
|
||||
|
||||
register_nav_menus(
|
||||
array(
|
||||
'primary' => __( '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( '<a href="%s"%s>%s</a>', 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' );
|
||||
Reference in New Issue
Block a user