if ( is_tag() ) { $title = sprintf( $args['tagtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name ); $href = get_tag_feed_link( $term->term_id ); } if ( is_tax() ) { $tax = get_taxonomy( $term->taxonomy ); $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); $href = get_term_feed_link( $term->term_id, $term->taxonomy ); } return [ 'title' => $title, 'href' => $href ]; } /** * Retrieve the attributes for the author feed. * * @since 4.2.1 * * @param array $args An array of arguments. * @return array An array of attributes. */ private function getAuthorAttributes( $args ) { $authorId = (int) get_query_var( 'author' ); $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $authorId ) ); $href = get_author_feed_link( $authorId ); return [ 'title' => $title, 'href' => $href ]; } /** * Retrieve the attributes for the search feed. * * @since 4.2.1 * * @param array $args An array of arguments. * @return array An array of attributes. */ private function getSearchAttributes( $args ) { $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); $href = get_search_feed_link(); return [ 'title' => $title, 'href' => $href ]; } /** * Get the currently queried post type. * * @since 4.2.1 * * @return string The currently queried post type. */ private function getQueriedPostType() { $postType = get_query_var( 'post_type' ); if ( is_array( $postType ) ) { $postType = reset( $postType ); } return $postType; } }