', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'apace_pingback_header' ); /** * Add a custom excerpt length. */ function apace_excerpt_length( $length ) { if( is_admin() ) { return $length; } $custom_length = get_theme_mod( 'apace_excerpt_length', 30 ); return absint( $custom_length ); } add_filter( 'excerpt_length', 'apace_excerpt_length', 999 ); /** * Changes the excerpt more text. */ function apace_excerpt_more( $more ) { if ( is_admin() ) { return $more; } if ( true == get_theme_mod( 'apace_show_readmore', false ) ) { return sprintf( '… %2$s', esc_url( get_permalink( get_the_ID() ) ), esc_html__( 'Read more', 'apace' ) ); } return '… '; } add_filter( 'excerpt_more', 'apace_excerpt_more' ); /** * Adds a Sub Nav Toggle to the Mobile Menu. * * @param stdClass $args An object of wp_nav_menu() arguments. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @return stdClass An object of wp_nav_menu() arguments. * @since Apace 1.0.0 */ function apace_add_dropdown_toggle_to_menu( $title, $item, $args, $depth ) { // Add sub menu toggles to the menu. if ( isset( $args->show_toggles ) && $args->show_toggles ) { $args->link_after = ''; // Add a toggle to items with children. if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { // Note: Implement mobile menu dropdown toggles later. $toggle_target_string = '.main-navigation .menu-item-' . $item->ID . ' > .sub-menu'; $svg_icon = apace_get_icon_svg('chevron-down'); // Add the sub menu toggle. $args->link_after = ''; } } return $title; } add_filter( 'nav_menu_item_title', 'apace_add_dropdown_toggle_to_menu', 10, 4 );