361 lines
12 KiB
PHP
361 lines
12 KiB
PHP
<?php
|
|
|
|
function kit_setup() {
|
|
|
|
load_theme_textdomain( 'kit', get_template_directory() . '/languages' );
|
|
|
|
add_theme_support( 'menus' );
|
|
add_theme_support( 'post-thumbnails' );
|
|
add_theme_support( 'custom-logo' );
|
|
|
|
};
|
|
|
|
add_action( 'after_setup_theme', 'kit_setup' );
|
|
|
|
# Registering menus
|
|
|
|
register_nav_menus( array(
|
|
'primary' => 'Main Menu',
|
|
'secondary' => 'Footer Menu',
|
|
'extra' => 'Extra Menu'
|
|
) );
|
|
|
|
function add_menu_link_class( $atts, $item, $args ) {
|
|
if (property_exists($args, 'link_class')) {
|
|
$atts['class'] = $args->link_class;
|
|
}
|
|
return $atts;
|
|
}
|
|
|
|
add_filter( 'nav_menu_link_attributes', 'add_menu_link_class', 1, 3 );
|
|
|
|
class kit_custom_main_menu extends Walker_Nav_Menu {
|
|
|
|
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
|
|
|
// depth dependent classes
|
|
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
|
|
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
|
|
$classes = array(
|
|
'sub-menu',
|
|
'menu-depth-' . $display_depth
|
|
);
|
|
$class_names = implode( ' ', $classes );
|
|
|
|
// build html
|
|
if ($display_depth == 1) {
|
|
$output .= "\n" . $indent . '
|
|
<section class="nav-second-level mega-flyout" style="">
|
|
<div class="content-wrap">
|
|
<div class="container container-3-cols">
|
|
' . "\n";
|
|
} else {
|
|
$output .= "\n" . $indent . '<ul>' . "\n";
|
|
}
|
|
}
|
|
|
|
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
|
|
|
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
|
|
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
|
|
$classes = array(
|
|
'sub-menu',
|
|
'menu-depth-' . $display_depth
|
|
);
|
|
$class_names = implode( ' ', $classes );
|
|
|
|
// build html
|
|
if ($display_depth == 1) {
|
|
$output .= "\n" . $indent . '
|
|
</div>
|
|
</div>
|
|
</section>' . "\n";
|
|
} else {
|
|
$output .= "\n" . $indent . '</ul>' . "\n";
|
|
}
|
|
}
|
|
|
|
function start_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
|
$object = $item->object;
|
|
$type = $item->type;
|
|
$title = $item->title;
|
|
$description = $item->description;
|
|
$permalink = $item->url;
|
|
|
|
$theme_template_path = get_template_directory_uri();
|
|
|
|
if ($depth == 1) {
|
|
$output .= '
|
|
<div class="column">
|
|
<div class="nav-second-level-group">
|
|
<a class="nav-second-level-group-headline" href="' . $permalink . '">
|
|
<div class="icon"></div>
|
|
<span>
|
|
';
|
|
$output .= $title;
|
|
$output .= '
|
|
</span>
|
|
</a>
|
|
<div class="nav-second-level-opener">
|
|
<span>Untermenu öffnen / schließen</span>
|
|
</div>';
|
|
} else {
|
|
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
|
|
$output .= '<div class="nav-first-level-opener">
|
|
<span>Untermenu öffnen / schließen</span>
|
|
</div>';
|
|
$output .= '<a href="' . $permalink . '">';
|
|
$output .= $title;
|
|
$output .= '</a>';
|
|
}
|
|
}
|
|
|
|
function end_el(&$output, $item, $depth = 0, $args=array(), $id = 0) {
|
|
$object = $item->object;
|
|
$type = $item->type;
|
|
$title = $item->title;
|
|
$description = $item->description;
|
|
$permalink = $item->url;
|
|
|
|
if ($depth == 1) {
|
|
$output .= '
|
|
</div>
|
|
</div>';
|
|
} else {
|
|
$output .= '</li>';
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
# Custom size settings for customizer
|
|
|
|
function theme_customize_register( $wp_customize ) {
|
|
|
|
$wp_customize->add_setting( 'theme_color', array(
|
|
'default' => '#009982',
|
|
'transport' => 'refresh',
|
|
) );
|
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control(
|
|
$wp_customize, 'theme_color', array(
|
|
'section' => 'colors',
|
|
'label' => esc_html__( 'Theme color', 'theme' ),
|
|
) ) );
|
|
|
|
$wp_customize->add_setting( 'kit_sidenav-mail', array(
|
|
'default' => '',
|
|
'type' => 'option',
|
|
'capability' => 'edit_theme_options'
|
|
),
|
|
);
|
|
|
|
$wp_customize->add_control( new WP_Customize_Control(
|
|
$wp_customize, 'sidenav_mail_control', array(
|
|
'label' => __( 'Contact mail', 'kit' ),
|
|
'description' => __( 'Mail address used in sidebar menu', 'kit' ),
|
|
'settings' => 'kit_sidenav-mail',
|
|
'priority' => 10,
|
|
'section' => 'title_tagline',
|
|
'type' => 'text',
|
|
)
|
|
) );
|
|
|
|
$wp_customize->add_setting( 'kit_sidenav-faqpage', array(
|
|
'sanitize_callback' => 'absint',
|
|
'default' => ''
|
|
),
|
|
);
|
|
|
|
$wp_customize->add_control( new WP_Customize_Control(
|
|
$wp_customize, 'kit_sidenav-faqpage', array(
|
|
'label' => __( 'FAQ page', 'kit' ),
|
|
'description' => __( 'FAQ page used in sidebar menu', 'kit' ),
|
|
'settings' => 'kit_sidenav-faqpage',
|
|
'section' => 'title_tagline',
|
|
'type' => 'dropdown-pages',
|
|
)
|
|
) );
|
|
|
|
$wp_customize->add_setting( 'kit_copyrighttext', array(
|
|
'default' => '',
|
|
'type' => 'option',
|
|
'capability' => 'edit_theme_options'
|
|
),
|
|
);
|
|
|
|
$wp_customize->add_control( new WP_Customize_Control(
|
|
$wp_customize, 'sidenav_copyrighttext', array(
|
|
'label' => __( 'Copyright text', 'kit' ),
|
|
'description' => __( 'Displayed in the footer', 'kit' ),
|
|
'settings' => 'kit_copyrighttext',
|
|
'section' => 'title_tagline',
|
|
'type' => 'text',
|
|
)
|
|
) );
|
|
|
|
$wp_customize->add_setting( 'kit_defaultimage', array(
|
|
'default' => '',
|
|
'type' => 'option',
|
|
'capability' => 'edit_theme_options'
|
|
),
|
|
);
|
|
|
|
$wp_customize->add_control( new WP_Customize_Image_Control(
|
|
$wp_customize, 'kit_defaultimage_control', array(
|
|
'label' => __( 'Default featured image', 'kit' ),
|
|
'settings' => 'kit_defaultimage',
|
|
'section' => 'title_tagline',
|
|
)
|
|
) );
|
|
|
|
}
|
|
|
|
add_action( 'customize_register', 'theme_customize_register' );
|
|
|
|
# Apply custom CSS settings
|
|
|
|
function kit_customize_css()
|
|
{
|
|
?>
|
|
<style type="text/css">
|
|
aside .aside-icon {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
nav > ul > li:hover > a,
|
|
nav > ul > li:active > a {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
/* change color on hover for language selector on mobile view */
|
|
.header-lang-small:hover li.active span {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.header-lang-small:hover .icon {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.dropdown-content li:hover span {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
nav > ul > li:hover > a::after,
|
|
nav > ul > li:active > a::after {
|
|
border-bottom: 4px solid <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.header-button {
|
|
/* background-image: linear-gradient(0deg, <?php echo get_theme_mod('theme_color', '#009982'); ?>, rgb(0,0,0,0.2)); */
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
box-shadow: inset 0 14px 16px -16px white;
|
|
}
|
|
|
|
.nav-second-level-group-headline {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.opened > a {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
nav > ul > li .nav-first-level-opener::before, nav > ul > li .nav-first-level-opener::after {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.nav-second-level .nav-second-level-opener::before, .nav-second-level .nav-second-level-opener::after {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.headline-element h2::after {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
form input[type='submit'] {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-searchbox form fieldset .tx-indexedsearch-search-submit button {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-browsebox ul li.current a {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-browsebox ul li a:hover {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-res {
|
|
border-bottom: 1px solid <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-res .tx-indexedsearch-title a:hover {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-res .link-more span:hover {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.tx-indexedsearch .tx-indexedsearch-browsebox ul li .current {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.nav-second-level-group-headline .icon {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.header-lang li a:hover {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.header-lang li.active span {
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
h2::after {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.page-category-marker {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.teaser-box-color-brand-secondary .teaser-box-category-marker {
|
|
border-bottom-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
.teaser-box-color-brand-secondary .teaser-box-category-marker:hover {
|
|
filter: brightness(120%);
|
|
}
|
|
|
|
.teaser-box-category-marker .icon {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
ul.catFilter li.available:hover {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
ul.catFilter li.active {
|
|
background-color: <?php echo get_theme_mod('theme_color', '#009982'); ?>;
|
|
}
|
|
|
|
</style>
|
|
<?php
|
|
}
|
|
|
|
add_action( 'wp_head', 'kit_customize_css');
|
|
|
|
# Search customizations
|
|
|
|
function kit_modify_posts_per_page( $query ) {
|
|
if ( $query->is_search() ) {
|
|
$query->set( 'posts_per_page', '10' );
|
|
}
|
|
}
|
|
add_action( 'pre_get_posts', 'kit_modify_posts_per_page' );
|