-
Notifications
You must be signed in to change notification settings - Fork 0
/
unmus_menu.php
50 lines (40 loc) · 1.22 KB
/
unmus_menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Menu
*
* @package unmus
* @since 0.7
*/
// Security: Stops code execution if WordPress is not loaded
if (!defined('ABSPATH')) { exit; }
/**
* Add Current Menu Item Class
*
* Required for Custom Post Type Archive Pages (2 to n)
*
* @since 0.2
*
* @param array $classes CSS Menu Item Classes
* @param object $item Current Menu Item
* @return array $classes CSS Menu Item Classes
*/
function unmus_menu_current_item_class( $classes, $item ) {
if (!in_array('current-menu-item',$classes)){
if(is_post_type_archive('pinseldisko') && $item->title == 'Pinseldisko') {
$classes[] = 'current-menu-item';
}
elseif(is_post_type_archive('raketenstaub') && $item->title == 'Raketenstaub') {
$classes[] = 'current-menu-item';
}
elseif(is_post_type_archive('ello') && $item->title == 'Zimtwolke') {
$classes[] = 'current-menu-item';
}
elseif(is_post_type_archive('podcast') && $item->title == 'Zirkusliebe') {
$classes[] = 'current-menu-item';
}
}
return $classes;
}
// This is not working anymore with Block Themes :-(
// add_filter( 'nav_menu_css_class', 'unmus_menu_current_item_class', 10, 2 );
?>