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.

Example:

Recent Articles

Charge Your Laptop Without a Charger in 5 Ways

Forgetting your laptop charger is a pretty common thing. We all have been there and all of...

Mobile-Only Bank versus Traditional Banks, Which one is for you?

Transactions over the internet are nothing new, online money transfer has been a part of our lives...

5 Reasons Behind The Slow Performance of Your iPhone

iPhone is a rather fast device, famous for its high level of performance. Most iPhone users define...

5 Apps to Use During Pregnancy for Android Users

Human birth is often described as the most beautiful phenomenon on the planet, but it could be equally as painful for the...

4 Best Apps to Teach Children to Read and Write at Home

Writing and reading are the two most basic skills that are taught to a kid. Though basic...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here