', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'analog_pingback_header' ); /** * Get author info * * @param int $author_id the author id * * @return string html */ function analog_get_author_box( $author_id = null ) { if( absint( $author_id ) <= 0 ) { return; } // Author name $display_name = get_the_author_meta( 'display_name', $author_id ); // Use nickname if display name is empty if ( empty( $display_name ) ) { $display_name = get_the_author_meta( 'nickname', $author_id ); } // Author description $user_description = get_the_author_meta( 'user_description', $author_id ); // Author URL $user_website = get_the_author_meta('url', $author_id); // Post for this author $user_posts = get_author_posts_url( get_the_author_meta( 'ID' , $author_id ) ); // About title if ( ! empty( $display_name ) ) { $author_details = sprintf( __( '%sAbout %s%s', 'analog' ), '

', $display_name, '

' ); } // Details if ( ! empty( $user_description ) ) { // Author avatar and bio $author_details .= '

' . get_avatar( get_the_author_meta('user_email') , 90 ) . $user_description . '

'; } // All posts by author if( ! is_archive() ) { $author_details .= sprintf( __( '%sView all posts%s', 'analog' ), ''; } else { if( ! is_archive() ) { $author_details .= '::'; } $author_details .= sprintf( __('%sSubscribe Feeds%s', 'analog' ), '', '' ); // if there is no author website then just close the paragraph $author_details .= '

'; } return '
' . $author_details . '
';; } /** * Retrieve link for feeds */ function analog_get_feeds_link() { $item = get_queried_object(); if( is_category() || is_tag() || is_tax() ) { $link = get_term_feed_link( $item->term_id, $item->taxonomy ); } elseif( is_post_type_archive() ) { $link = get_post_type_archive_feed_link( $item->name ); } return $link; } /** * Remove prefix from archive title * @see: https://developer.wordpress.org/reference/functions/get_the_archive_title/ * * @param string $title the archive's title * @return string */ function analog_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = '' . get_the_author() . ''; } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title = single_term_title( '', false ); } return $title; } /** * Filter archive description * * @param string $description the archive description * @return string */ function analog_archive_description( $description ) { add_filter( 'get_the_archive_title', 'analog_archive_title' ); $item = get_the_archive_title(); remove_filter('get_the_archive_title', 'analog_archive_title' ); $content = $description; $feeds = analog_get_feeds_link(); $description = sprintf( __( '%sAbout %s%s', 'analog' ), '

', $item, '

' ); $description .= $content; $description .= sprintf( __( '%sSubscribe Feeds%s', 'analog' ), '

', '

' ); return $description; } add_filter( 'get_the_archive_description', 'analog_archive_description' );