Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,

    thanks for reaching out! Here you go:
    replace the
    $output .= '<a href="' . $post_url . '" class="wp_rp_title">' . wptexturize($related_post->post_title) . '</a>';
    in the init.php file with:
    $output .= '<a href="' . $post_url . '" class="wp_rp_title">' . wptexturize($related_post->post_title) . "&nbsp by &nbsp" . get_the_author() . '</a>';

    Take care and have a nice day,
    Petra

    Thread Starter kesernio

    (@kesernio)

    Thanks for the response, Petra! That did the trick and I modified it slightly because I wanted the author name to have it’s own styling like so:

    $output .= ‘<h4 class=”wp_rp_author”>’ . get_the_author() . ‘</h4>’;

    I do have one last question on the matter. My previous developer built a custom field in wordpress for the author and I’m not entirely sure how to insert that. This is how it’s being referenced currently: <?php echo _m(‘author-name’); ?>. How can I display this custom field instead?

    Your help is much appreciated!

    Thnx

    Thread Starter kesernio

    (@kesernio)

    I was able to get it to work with this:

    $output .= ‘<h4 class=”wp_rp_author”>’ . _m(‘author-name’) . ‘</h4>’;

    However, the “author-name” is displaying the “author-name” for the post page that I’m on. From doing some research I think it’s because get the “author-name” from outside the loop. Any help would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Include Author beneath each related post title’ is closed to new replies.