theme_location ) { return $classes; } // For the main menu add 'uk-parent' class to elements that has children items. if ( in_array( 'menu-item-has-children', $classes ) ) { array_push( $classes, 'uk-parent' ); } return $classes; } } if ( ! function_exists( 'basho_filter_main_nav_menu_item_args' ) ) { /** * Add UIkit chevron-down icon to navbar menu item with childrens. */ function basho_filter_main_nav_menu_item_args( $args, $item, $depth ) { // Place chevron-down icon after a link element. if ( 'main' == $args->theme_location ) { $args->link_after = ( $args->walker->has_children ) ? '' : ''; } return $args; } } if ( ! function_exists( 'basho_filter_social_menu_icons' ) ) { /** * Add icons and other attributes to social menu links. */ function basho_filter_social_menu_icons( $atts, $item, $args ) { // Check if item url has a certain string and add UIkit icon attribute to link if so. if ( $args->theme_location == 'social' ) { $atts['target'] = '_blank'; $atts['rel'] = 'nofollow'; $atts['class'] = 'uk-icon-button'; $atts['data-uk-icon'] = basho_get_social_icon_id( $item->url ); } return $atts; } } if ( ! function_exists( 'basho_filter_the_archive_title' ) ) { /** * Add UIkit classes and icons to archive titles. */ function basho_filter_the_archive_title( $title ) { if ( is_tag() ) { // I like to use '#' symbol before hashtag. That's why I added this filter. $prefix = apply_filters( 'basho_archive_tag_title_prefix', '' ); $title = single_tag_title( $prefix, false ); } if ( is_author() ) { $title = '' . get_the_author() . ''; } return $title; } } if ( ! function_exists( 'basho_filter_comments_popup_link_attributes' ) ) { /** * Scroll to comments section when comments popup link is clicked. */ function basho_filter_comments_popup_link_attributes( $attributes ) { $attributes .= ' data-uk-scroll'; return $attributes; } } if ( ! function_exists( 'basho_skip_link' ) ) { /** * Include a skip to content link at the top of the page so that users can bypass the menu. */ function basho_skip_link() { printf( '%s', esc_attr__( 'Skip to the content', 'basho' ), esc_html__( 'Skip to the content', 'basho' ) ); } } if ( ! function_exists( 'basho_offcanvas_navigation_toggle' ) ) { /** * Display offcanvas navigation toggle button if the WooCommerce plugin is activated. */ function basho_offcanvas_navigation_toggle() { if ( has_nav_menu( 'offcanvas' ) && basho_is_woocommerce_activated() ) { ?>
'; if ( has_custom_logo() ) { the_custom_logo(); } else { ?> '; } } if ( ! function_exists( 'basho_filter_get_custom_logo' ) ) { /** * Filter custom logo markup. */ function basho_filter_get_custom_logo( $html ) { $logo_id = get_theme_mod( 'custom_logo' ); if ( ! $logo_id ) { return $html; } $logo = wp_get_attachment_image_src( $logo_id, 'full' ); if ( $logo ) { // For clarity. $logo_width = esc_attr( $logo[1] ); $logo_height = esc_attr( $logo[2] ); // If the basho_retina_logo logo setting is active, reduce the width/height by half. if ( get_theme_mod( 'basho_retina_logo', false ) ) { $logo_width = floor( $logo_width / 2 ); $logo_height = floor( $logo_height / 2 ); $search = array( '/width=\"\d+\"/iU', '/height=\"\d+\"/iU', ); $replace = array( "width=\"{$logo_width}\"", "height=\"{$logo_height}\"", ); // Add a style attribute with the height, or append the height to the style attribute if the style attribute already exists. if ( strpos( $html, ' style=' ) === false ) { $search[] = '/(src=)/'; $replace[] = "style=\"height: {$logo_height}px;\" src="; } else { $search[] = '/(style="[^"]*)/'; $replace[] = "$1 height: {$logo_height}px;"; } $html = preg_replace( $search, $replace, $html ); } } return $html; } } if ( ! function_exists( 'basho_header_navbar' ) ) { /** * Display main navigation. */ function basho_header_navbar() { if ( has_nav_menu( 'main' ) ) { ?> ' . get_search_query() . '' ); if ( $wp_query->found_posts ) { if ( 1 === (int) $wp_query->found_posts ) { $archive_description = __( 'We found single result for your search:', 'basho'); } else { $archive_description = __( 'Here are the results we found on your request:', 'basho' ); } } else { $archive_description = __( 'We could not find any results for your search. Maybe you can give it another try.', 'basho' ); } } elseif ( is_archive() ) { $archive_title = get_the_archive_title(); $archive_description = get_the_archive_description(); } elseif ( is_home() ) { $archive_title = ( get_option( 'page_for_posts', true ) ) ? get_the_title( get_option( 'page_for_posts', true ) ) : __( 'Blog', 'basho' ); $archive_description = get_bloginfo( 'description' ); } if ( $archive_title || $archive_description ) { $archive_header_classnames = ( $archive_description ) ? ' has-description' : ' no-description'; $archive_header_classnames .= ( get_theme_mod( 'basho_pro_show_blog_categories', false ) ) ? ' categories-shown' : ' categories-hidden'; ?>