How to Rewrite Guest Author Name with Custom Fields

Have you ever had a visitor put up for your weblog? How do you cross about giving the writer complete credit score? We have observed many websites the place they upload an writer profile field both above the put up or beneath the put up. But even with the visitor writer field, the writer identify box would nonetheless display the website writer. Some bloggers create complete new writer profiles for his or her visitor authors so as to show the best identify. We suppose that it’s needless to create additional consumer profiles if you recognize that this visitor writer will handiest put up as soon as.

The trick we’re sharing in this text will permit you to display visitor writer’s identify by way of merely getting into a customized box to your put up.

Open your purposes.php report and paste the codes beneath:

    add_filter( 'the_author', 'guest_author_name' );
    add_filter( 'get_the_author_display_name', 'guest_author_name' );

    serve as guest_author_name( $identify ) {
    international $put up;

    $writer = get_post_meta( $post->ID, 'guest-author', true );

    if ( $writer )
    $identify = $writer;

    go back $identify;

Now each time that you’re posting a visitor put up, simply just be sure you upload a customized box known as guest-author and it’s going to substitute the writer’s identify with the textual content that you just installed that customized box.


Recent Articles

How to Add Popups in WordPress?

Do you want to increase your website's conversion rate? Popup is an effective marketing tool for generating leads and it has a...

What is an XML Sitemap? How to Create a Sitemap in WordPress?

An XML sitemap is helping engines like google simply navigate thru your web site content material. It provides them a listing of your whole...

Vintage iPhone Film Camera Apps that you need to use in 2020

The iPhone has a great camera and it keeps getting better with every new version of the phone. Have you noticed how...

Transfer Your Data From Your Old iPhone to Your New iPhone

Want to buy a new iPhone this season, but don’t want to do all the work of transferring your data. Well, I...

Best Tools and Resources to Write Professionally for Everyone

Writing is considered the best medium to communicate your views, cause unlike speaking you can edit and improve. Written communication provides the...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here