How to add the author name in wordpress manually through coding

Recently I bought a template from Themeforest.com. I have an issue with this template. I am unable to display the author name on the blog post. I have tried every different option but none are working. Also tried to edit the functions.php, theme-function.php pages by adding the_author() function but no luck. Could you guys please help me out. The code where the author name is missing is defined below.

if ( ! function_exists( 'ishyoboy_get_post_details' ) ) {
  function ishyoboy_get_post_details(){
    $return = '';
      global $post;
        $author_id=$post->post_author;
        get_author_posts_url( $author_id );

        ob_start(); ?>
        <span class="ish-blog-post-details">
          <span><?php _e( 'by', 'ishyoboy'); ?></span> 
                  <?php echo the_author_posts_link(); ?>
        </span>  
                <?php
          $return .= ob_get_contents();
          ob_end_clean();
          return $return;
                ?>
    }
}

Ideally the author name should be displayed in

  <span><?php _e( 'by', 'ishyoboy'); ?></span> 
  <?php echo the_author_posts_link(); ?>

but its not.

Thank you

Read more here: How to add the author name in wordpress manually through coding

Leave a Reply

Your email address will not be published. Required fields are marked *