'custom-logo', ); $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); if ( empty( $image_alt ) ) { $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); } if ( get_theme_mod( 'twentig_header_sticky' ) ) { $custom_logo_attr['class'] = 'custom-logo logo-primary'; $custom_logo_transparent_attr = $custom_logo_attr; $custom_logo_transparent_attr['class'] = 'custom-logo logo-transparent'; $html = sprintf( '%2$s', esc_url( home_url( '/' ) ), wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ) . ' ' . wp_get_attachment_image( $custom_logo_transparent_id, 'full', false, $custom_logo_transparent_attr ) ); } else { $html = sprintf( '%2$s', esc_url( home_url( '/' ) ), wp_get_attachment_image( $custom_logo_transparent_id, 'full', false, $custom_logo_attr ) ); } } return $html; } add_filter( 'get_custom_logo', 'twentig_logo_transparent' ); /** * Hide the tagline by returning an empty string. */ function twentig_hide_tagline( $html ) { if ( ! get_theme_mod( 'twentig_header_tagline', true ) ) { return ''; } return $html; } add_filter( 'twentytwenty_site_description', 'twentig_hide_tagline' ); /** * Determines if social icons should be displayed in the location. */ function twentig_is_socials_location( $location ) { $locations = get_theme_mod( 'twentig_socials_location', array( 'modal-desktop', 'modal-mobile', 'footer' ) ); return in_array( $location, $locations ); } /** * Adds social links in the primary menu. */ function twentig_nav_menu_social_icons( $items, $args ) { if ( 'primary' === $args->theme_location && has_nav_menu( 'social' ) && twentig_is_socials_location( 'primary-menu' ) ) { $items = $items . ''; } return $items; } add_filter( 'wp_nav_menu_items', 'twentig_nav_menu_social_icons', 20, 2 ); /** * Disable the social icons menu inside the modal menu depending on the Customizer setting. */ function twentig_modal_menu() { remove_filter( 'wp_nav_menu_items', 'twentig_nav_menu_social_icons', 20 ); if ( ! twentig_is_socials_location( 'modal-mobile' ) && ! twentig_is_socials_location( 'modal-desktop' ) ) { add_filter( 'has_nav_menu', 'twentig_disable_socials', 10, 2 ); } } add_action( 'get_template_part_template-parts/modal-menu', 'twentig_modal_menu', 10, 2 ); /** * Disable social icons menu for a given location. */ function twentig_disable_socials( $has_nav_menu, $location ) { if ( 'social' === $location ) { return false; } return $has_nav_menu; } /** * Add support for excerpt to page. */ function twentig_support_page_excerpt() { add_post_type_support( 'page', 'excerpt' ); } add_action( 'init', 'twentig_support_page_excerpt' ); /** * Set template for page cover with excerpt. */ function twentig_page_cover_excerpt( $template ) { if ( is_page_template( 'templates/template-cover.php' ) && is_page() && has_excerpt() ) { return TWENTIG_PATH . 'inc/twentytwenty/templates/template-cover.php'; } return $template; } add_filter( 'template_include', 'twentig_page_cover_excerpt' );