From 05706ec17d5c359ba86aa9cdd7685e637b4e25ab Mon Sep 17 00:00:00 2001 From: tradam Date: Tue, 18 Nov 2025 23:46:33 +0000 Subject: v 1.0 --- functions.php | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) mode change 100644 => 100755 functions.php (limited to 'functions.php') diff --git a/functions.php b/functions.php old mode 100644 new mode 100755 index d971ab2..f48605d --- a/functions.php +++ b/functions.php @@ -1,9 +1,79 @@ get('Version')); + +function malcz_theme_setup() { + add_theme_support('title-tag'); +} +add_action('after_setup_theme', 'malcz_theme_setup'); + function load_css() { - wp_register_style('picocss', get_template_directory_uri() . '/css/pico.css.min', array(), false, 'all' ); - wp_enqueue_style('picocss'); + wp_enqueue_style( + 'picocss', + get_template_directory_uri() . '/css/pico.min.css', + array(), + THEME_VERSION, + 'all' + ); + + wp_enqueue_style( + 'header', + get_template_directory_uri() . '/css/header.css', + array('picocss'), + THEME_VERSION, + 'all' + ); } add_action('wp_enqueue_scripts', 'load_css'); +function load_js() { + wp_enqueue_script( + 'theme-switcher', + get_template_directory_uri() . '/js/minimal-theme-switcher-picocss.js', + array(), + THEME_VERSION, + true + ); + + + wp_enqueue_script( + 'parallax-header', + get_template_directory_uri() . '/js/parallax-header.js', + array(), + THEME_VERSION, + true + ); +} +add_action('wp_enqueue_scripts', 'load_js'); + +add_theme_support('menus'); + +register_nav_menus( + + array( + 'top-menu' => 'Top Menu Location', + //'mobile-menu' => 'Mobile Menu Location' + ) +); + +add_filter('nav_menu_link_attributes', function($atts, $item, $args, $depth) { + // Only target the top-menu + if ($args->theme_location === 'top-menu') { + // Add 'contrast' only to links that are NOT the current page + if (empty($atts['aria-current']) || $atts['aria-current'] === 'false') { + if (!empty($atts['class'])) { + $atts['class'] .= ' contrast'; + } else { + $atts['class'] = 'contrast'; + } + } + } + return $atts; +}, 10, 4); + +function register_navwalker() { + require_once get_template_directory() . '/plugins/class-wp-picocss-navwalker.php'; +} +add_action('after_setup_theme', 'register_navwalker'); -- cgit v1.2.3