code help
-
Hi. I am using this code in my free theme to show author link for a custom header. How do I change the author link so that instead of pointing to author pages when clicked, it instead takes the user to a custom author page likeexample.com/author-page
?
<span class="entry-author"> <?php if (! has_category( array( 5 ) ) ) { the_post(); // queue first post echo apply_filters( 'generate_post_author_output', sprintf( '<span class="byline">%1$s</span> ', // WPCS: XSS ok, sanitization ok. sprintf( '<span class="author vcard" %5$s>%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>', __( 'by', 'generatepress' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), /* translators: 1: Author name */ esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), generate_get_microdata( 'post-author' ) ) ) ); rewind_posts(); // rewind the loop } ?> </span>
Solved. Replaced
href="%2$s"
with the author page URL.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘code help’ is closed to new replies.