How to implement guest authors and credit content creators under title?

Hi guys,

I have been tinkering with your awesome activello theme on xampp and had some questions about how to best implement guest-authors. I was wondering if you could help me with this. We are running a magazine site where the admin will post articles written by other people. I currently use the custom field key ‘guest-author’ to achieve this. For implementation, I have put the following code in functions.php in a child-theme:

/** * Replaces authors with 'guest-author' custom field if present. */ add_filter( 'the_author', 'guest_author_name' ); add_filter( 'get_the_author_display_name', 'guest_author_name' );

function guest_author_name( $name ) {
global $post;

$author = get_post_meta( $post->ID, ‘guest-author’, true );

if ( $author )
$name = $author;

return $name;

This replaces the ‘author’ with ‘guest-author’ in the dashboard, which allows admins to see at a glance which posts have which guest-author, and which do not have a guest-author at all (they may have forgotten to enter one). It also shows the ‘guest-author’ in place of ‘author’ (which is often the admin) on the feed. Which is handy, because if a reader has a favorite author he can see directly which posts are by the author he likes. But I would like to use a different custom field for this, namely ‘feed-author’, because this information will display in the feed. Do I just replace all instances of guest_author with feed_author?

Now, in the single post view, I would like to display some meta data as well. However sometimes a post will have an accompanying video or image which needs to be credited. Or sometimes, I will need to credit the guest-author as text-creator, instead of the principal author, because the content is a collaborative project by a writer and a illustrator. In some cases, there will be a translator which needs to be displayed.

I have been thinking about the best way to structure this information and I have thought of the follow custom fields:

‘feed-author’ -> this would take the place of ‘guest-author’ in the code-example displayed above. it would show in the dashboard and in the feed, and we can determine what information we would like readers to see at a glance.

‘general-author’ -> this would display in the single post view as ‘By: %general-author%’

‘image-author’ -> this would display in the single post view as ‘Image by: %image-author%’

‘video-author’ -> Ibid.

‘photo-author’ -> Ibid.

‘text-author’ -> Ibid.

‘translator’ -> 'Translated by: %translator%

So the output in single-post view could look like many possibilities:

By: %general-author% / Image by: %image-author%
Image by: %image-author% / Sound by: %sound-author%
Text by: %text-author% / Video by: %video-author%
By: %general-author% / Photo by: %photo-author% / Sound by: %sound-creator%
By: %general-author% / Translation by: %translator%

So to summarize:

  1. How to change the example code for usage with the custom field ‘feed-author’ instead of ‘guest-author’? Do I just search and replace?

  2. How to display the chosen metadata under the title in single post view, where the metadata is displayed on a single line and in various possible combinations, depending on which custom fields have values, separated by a slash or other symbol.

Well, this is a pretty long question. I hope you are able to help me with this. In any case, thanks for your time and consideration.

Ah, I just thought of an easier way. I just have two custom fields:

‘feed-author’ -> here I fill in only the name of the author or authors I want to show, e.g.: ‘VALUE: Jack & Jill’, which would output in the feed display as: ‘By: Jack & Jill’

‘page-author’ -> this I can fill in with the format I want, e.g. ‘VALUE: By: Jack / Photo: Jill’, which would just output as what it is.

So my question is simply, how do I depict custom field meta data under the title?

Hi @seikopath,

I hope you are well today and thank you for your question.

To achieve this you will have to develop custom code.

Developing custom code for custom functionality is beyond the scope of support that we provide here.

If you are not a developer then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Colorlib recommends the developer

Best Regards,

Hi Movin,

Thanks for response! I have now found a solution and implemented it.


You are most welcome here :slight_smile: