Inserting text near the author name in a post

Posted in: Newsmag
Post count: 94

Hi

in my wordpress database I have for every post a custom field that contains the city of the news I’m writing about

I would like to put this info near the author name below the post title
Can you give me some advise on what part of code modify please?

thanks
Paolo

Post count: 6535

Hi

You can use the get_post_meta() in the file corresponding with the post template used like here: http://screencast.com/t/kaeb5gfzT

<div class="my-meta">
    <?php echo get_post_meta($td_mod_single->post->ID, 'my_custom_field', true); ?>
</div>

Just replace the my_custom_field with your custom field name.
Thanks!

  • This reply was modified 10 years by Andrei L..
Post count: 13

Hello I do not have any custom fields in my WordPress database. However on a few posts I would like to add the name of the Editor below the Authors Name. How should I go about adding this text to the post?

Post count: 6535

Hi

You can add a custom filed using this add_post_meta() function. For more details in this regard please check this link: https://codex.wordpress.org/Function_Reference/add_post_meta
You have to edit the file corresponding with post template used and echo out the custom files after author box: http://screencast.com/t/ACAUCsvmXhtI
Note that this is a complex task which involve some customizations and also good coding skills are involved in order to be completed. We can’t offer customization services at the moment so if you still need guidance on this or you’re not aware of the steps you need to take in this regard please consider hiring a developer or a freelancer to do this for you.

Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newsmag’ is closed to new topics and replies.