Hi there,
I’m trying to make a shortcode to display a button that leads to author’s posts page, found the following code here, but inserting it in functions.php file gives: syntax error, unexpected ‘<‘.
function author_posts_page_button() {
ob_start();
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>"><?php the_author(); ?></a>
return ob_get_clean();
}
add_shortcode( 'author_posts_page_button', 'author_posts_page_button' );
What can I do to make it work?
Thank you.