'Main Menu',
'secondary' => 'Footer Menu',
'extra' => 'Extra Menu'
) );
};
add_action( 'after_setup_theme', 'kit_setup' );
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 . '
' . "\n";
} else {
$output .= "\n" . $indent . '
' . "\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 . '
' . "\n";
} else {
$output .= "\n" . $indent . '' . "\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 .= '
';
$output .= $title;
$output .= '
Untermenu öffnen / schließen
';
} else {
$output .= "
";
$output .= '
Untermenu öffnen / schließen
';
$output .= '';
$output .= $title;
$output .= '';
}
}
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 .= '
';
} else {
$output .= '';
}
}
}
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_section( 'kit_advanced_settings' , array(
'title' => __('Advanced settings','kit'),
'priority' => 30,
) );
$wp_customize->add_setting( 'kit_url_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'kit_sanitize_url',
) );
$wp_customize->add_control( 'kit_url_setting_id', array(
'type' => 'url',
'section' => 'nav',
'label' => __( 'Custom URL' ),
'description' => __( 'This is a custom url input.' ),
'input_attrs' => array(
'placeholder' => __( 'http://www.google.com' ),
),
) );
function kit_sanitize_url( $url ) {
return esc_url_raw( $url );
}
}
add_action( 'customize_register', 'kit_advanced_settings' );
add_action( 'customize_register', 'theme_customize_register' );
function kit_customize_css()
{
?>
is_search() ) {
$query->set( 'posts_per_page', '10' );
}
}
add_action( 'pre_get_posts', 'kit_modify_posts_per_page' );