esc_html__( 'Primary', 'manta' ), 'header' => esc_html__( 'Header' , 'manta' ), 'footer' => esc_html__( 'Footer' , 'manta' ), ) ); return $locations; } /** * Theme widget areas. * * @since 1.0.0 * * @param array $widgets Widget area args. * @return array Returns Args for widgets to be registered. */ public static function get_widgets( $widgets = array() ) { $secondary_sidebar_text1 = esc_html__( 'Add widgets here to appear in your secondary sidebar.', 'manta' ); $secondary_sidebar_text2 = esc_html__( 'This is the secondary sidebar if you are using a three column site layout option. This widget area is not suitable to display every type of widget due to its narrow width.', 'manta' ); $widgets = array_merge( $widgets, array( array( 'name' => esc_html__( 'Primary Sidebar', 'manta' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'This is the primary sidebar if you are using a two or three column site layout option.', 'manta' ), ), array( 'name' => esc_html__( 'Secondary Sidebar', 'manta' ), 'id' => 'sidebar-2', 'description' => is_active_sidebar( 'sidebar-1' ) ? $secondary_sidebar_text1 : $secondary_sidebar_text2, ), array( 'name' => esc_html__( 'Header', 'manta' ), 'id' => 'header', 'description' => esc_html__( 'The header widget appears next to your site title or logo. This widget area is not suitable to display every type of widget, and works best with a custom menu, search form, or text widget.', 'manta' ), ), array( 'name' => esc_html__( 'Footer Widget 1', 'manta' ), 'id' => 'footer-1', 'description' => '', ), array( 'name' => esc_html__( 'Footer Widget 2', 'manta' ), 'id' => 'footer-2', 'description' => '', ), array( 'name' => esc_html__( 'Footer Widget 3', 'manta' ), 'id' => 'footer-3', 'description' => '', ), array( 'name' => esc_html__( 'Footer Widget 4', 'manta' ), 'id' => 'footer-4', 'description' => '', ), array( 'name' => esc_html__( 'Footer Widget 5', 'manta' ), 'id' => 'footer-5', 'description' => '', ), ) ); return $widgets; } /** * Localize script data for manta javascripts. * * @since 1.0.0 * * @param array $script_data Localize script data. * @return array */ public static function localize_script_data( $script_data = array() ) { $script_data = array_merge( $script_data, array( 'expand' => esc_html__( 'Expand child menu', 'manta' ), 'collapse' => esc_html__( 'Collapse child menu', 'manta' ), 'icon' => manta_get_icon( array( 'icon' => 'angle-down', 'fallback' => true, ) ), 'primary' => 'main-navigation', 'secondary' => 'header-menu', ) ); return $script_data; } /** * Change excerpt length. * * Change excerpt length to be displayed on main, archive and search * pages, default excerpt length is 55. * * @since 1.0.0 * * @param int $length excert length. * @return integer */ public static function change_excerpt_length( $length ) { $length = absint( get_theme_mod( 'manta_excerpt_length', manta_get_theme_defaults( 'manta_excerpt_length' ) ) ); return $length; } /** * Add search form in primary menu. * * Conditionally add search form and search toggle in primary navigation menu. * * @since 1.2 * * @param array $args Array of nav menu arguments. * @return array */ public static function primary_nav_search( $args ) { if ( 'primary' !== $args['theme_location'] ) { return $args; } if ( '' === get_theme_mod('manta_nav_search', manta_get_theme_defaults( 'manta_nav_search' ) ) ) { return $args; } $search_toggle = sprintf( '', manta_get_attr( 'search-toggle' ), manta_get_icon( array( 'icon' => 'search' ) ), manta_get_icon( array( 'icon' => 'close' ) ) ); $search_item = sprintf( '%2$s', manta_get_attr( 'search-item' ), $search_toggle ); $args['items_wrap'] = get_search_form( false ) . $args['items_wrap'] . $search_item; return $args; } /** * Change Read more text. * * Change excerpt read more link text based on custom text entered in * theme customizer. * * @since 1.0.0 * * @return string */ public static function modify_excerpt_teaser() { $url = esc_url( get_permalink() ); $text = esc_html( get_theme_mod( 'manta_excerpt_teaser', manta_get_theme_defaults( 'manta_excerpt_teaser' ) ) ); $title = get_the_title(); if ( 0 === strlen( $title ) ) { $screen_reader = ''; } else { $screen_reader = sprintf( '%s', $title ); } $excerpt_teaser = sprintf( '', $url, $text, $screen_reader ); return $excerpt_teaser; } /** * Modify custom logo attributes. * * Modify 'itemprop="logo"' and 'alt' attributes to address google strucutral data * and accessibility related errors. * * @since 1.0.0 * * @param array $attr Attributes for the image markup. * @param WP_Post $attachment Image attachment post. * @return array */ public static function custom_logo_attr( $attr, $attachment ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id === $attachment->ID ) { if ( isset( $attr['itemprop'] ) ) { unset( $attr['itemprop'] ); } if ( ! get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) ) { $attr['alt'] = get_bloginfo( 'name', 'display' ); } } return $attr; } } Manta_Filters::initiate();