Get author meta function to retrieve author url
-
I am trying to customise the Basic theme (by WP Puzzle) using a child theme to apply a hyperlink to the author name, for the post meta that appears under the post title on a single post page. The archive pages display a link to the author page but the single posts do not.
I have found the relevant piece of code inside the theme files called
html-blocks.php
. It shows that the author name post meta will output aspan
rather than a link. The parent file snippet looks like this:case 'author': $meta_html[ $meta ] = '<span class="author' . $preview . '">' . get_the_author() . '</span>'; break;
I have referred to this document to try to customise this line inside a duplicate of this file copied to the child theme and listed inside the same directory.
This is the code I have tried:
case 'author': $meta_html[ $meta ] = '<span class="author' . $preview . '"><a href="' . get_the_author_meta('url', $author_id) . '">' . get_the_author() . '</a></span>'; break;
Currently:
-
Any changes I make to the
html-blocks.php
file in the child theme does not have any effect.
I applied the code to the parent theme file just to confirm I was working with the right file and was able to apply a link to the home page only, for some reason, the author url is not getting applied. Perhaps this has something to do with the staging extension I am using for the development site?Any suggestions welcome. Thank you in advance for your help!
The page I need help with: [log in to see the link]
- The topic ‘Get author meta function to retrieve author url’ is closed to new replies.