%s %s', esc_html__( 'Category', 'bastet' ), single_cat_title( '', false ) ); } elseif ( is_tag() ) { $title = sprintf( '%s %s', esc_html__( 'Tag', 'bastet' ), single_tag_title( '', false ) ); } elseif ( is_author() ) { $title = sprintf( '%s %s', get_avatar( get_the_author_meta( 'ID' ), 80 ), get_the_author() ); } elseif ( is_tax() ) { $title = sprintf( '%1$s', single_term_title( '', false ) ); } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } return $title; } add_filter( 'get_the_archive_title', 'bastet_filter_archive_title', 11 ); /** * Add theme mods to body classes * * @param array $classes List of body classes. */ function bastet_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } $classes[] = 'header-' . get_theme_mod( 'header_style', 'light' ); if ( is_active_sidebar( 'instagram-footer' ) ) { $classes[] = 'has-instagram-footer'; } if ( is_singular() ) { if ( has_post_thumbnail( get_the_ID() ) ) { $classes[] = 'with-thumb'; } else { $classes[] = 'no-thumb'; } } $classes[] = 'single-' . bastet_get_single_layout(); if ( ( is_singular() && ! is_front_page() ) || ( is_archive() ) || ( is_404() ) || ( is_search() ) ) { if ( get_theme_mod( 'header_style', 'light' ) === 'transparent' && get_theme_mod( 'header_archive_dark', true ) ) { $classes[] = 'header--dark'; } } if ( is_404() ) { $classes[] = 'header--spacing'; $classes[] = 'header--divider'; } if ( is_page() && ! has_post_thumbnail() ) { $classes[] = 'no-thumb'; } if ( get_theme_mod( 'top_header', false ) ) { $classes[] = 'header-topbar'; } if ( ! get_theme_mod( 'footer_widgets', false ) ) { $classes[] = 'footer-light'; } return $classes; } add_filter( 'body_class', 'bastet_body_classes' ); /** * Remove tag cloud widget inline style * * @param string|string[] $return Tag cloud as a string or an array, depending on 'format' argument. */ function bastet_tag_cloud_btn( $return ) { if ( ! is_array( $return ) ) { $return = preg_replace( '/style="(.+?)"/i', ' ', $return ); } return $return; } add_filter( 'wp_tag_cloud', 'bastet_tag_cloud_btn' ); /** * Add sidebar position to main area class list * * TODO: using something like body_class for site main class */ function bastet_main_area_class() { $sidebar = bastet_get_sidebar_position(); return $sidebar; } add_filter( 'bastet_site_main_class', 'bastet_main_area_class' ); /** * Add theme class to read more button */ function bastet_modify_read_more_link() { return sprintf( '%2$s', get_permalink(), esc_html__( 'Read More', 'bastet' ) ); } add_filter( 'the_content_more_link', 'bastet_modify_read_more_link' ); /** * Add the number of columns for footer widget as class name to parent div * * @param array $classes List of footer widgets classes. */ function bastet_footer_widgets_extra_classes( $classes ) { $classes[] = get_theme_mod( 'footer_columns', 'footer-1' ); return $classes; } add_filter( 'bastet_footer_widgets_class', 'bastet_footer_widgets_extra_classes', 11 ); /** * Fix problem with missing widget content wrapper if no title is presented since the closing div is added already on after_title param * * @see bastet_widgets_init() * * @param array $params array of arrays for sidebar params. */ function bastet_check_sidebar_params( $params ) { global $wp_registered_widgets; $settings_getter = $wp_registered_widgets[ $params[0]['widget_id'] ]['callback'][0]; $settings = $settings_getter->get_settings(); $settings = $settings[ $params[1]['number'] ]; if ( '' === $params[0]['after_widget'] && ( ! isset( $settings['title'] ) || empty( $settings['title'] ) ) ) { $params[0]['before_widget'] .= '