[Resolved] Author posts page button shortcode

Home Forums Support [Resolved] Author posts page button shortcode

Home Forums Support Author posts page button shortcode

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #459781
    themedleb

    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.

    #459783
    themedleb

    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.

    #459882
    Leo
    Staff
    Customer Support

    Glad you figured out 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.