Archived topic
Author posts page button shortcode
2 replies · Started by themedleb on December 30, 2017
Viewing posts 1–3 of 3
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.
I'm sorry, don't mind this, I did solve it, the issue was with the starting and ending of php markup in the functions.php file.
Thanks.
Glad you figured out :)
This archived topic is closed to new replies.