• I was googling to find out how to add the author to my posts (when I am posting it but am not the author) and found a 2 year old post that said to create a custom field and then put this in “The Loop”

    $customField = get_post_custom_values(“~YourCustomField~”);
    if (isset($customField[0])) {
    echo “Author: “.$customField[0];
    }

    I have no idea what they mean. I read that the loop is a place to put custom code I believe? but I cant find The Loop

Viewing 3 replies - 1 through 3 (of 3 total)
  • there’s no place called “the loop”. The loop is the function of wordpress than grabs the info of BBDD and displays it in the browser (a page, a post, lastest posts).

    By convenience we call “the loop” as the page of your template than does it and many people uses the “loop” when display lastest posts only (not single posts or pages).

    When Wordrpress retrieves info form DDBB displays it a function like this

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
       <h1><?php the_title(); ?></h1>
    
        <?php the_content(); ?>
    
    <?php endwhile; endif; ?>

    This function is the loop, all info anf meta of post (like author, permalink, content, custom fields, timestamp…) is accessible inside the loop.

    You can display additional info on it…. But require some PHP encoding skills to edit code from your template or by creating a child template.

    Anyway, inside the loop the info about “the author” of a post is avaible in wordpress, no custom field required… As you display the title calling the function

    <?php the_title(); ?>

    you can display a post author using

    <?php the_author(); ?>

    But you’ll need edit code to it, too.

    Another option is use some plugin like Fancier Author Box to it. It’s a easiest solution… i guess

    Thread Starter Harvezter

    (@harvezter)

    I was excited to try Fancier Author Box so I installed it however all it does is echo the name of the person who posted the article.

    I am posting articles for many people, all under my name, and I want to be able to give author credits to them.

    Those users need to exist in WordPress. You have to create a profile for each along with all the info you want to show for them. You can set them to be either authors or contributors.

    You, as an admin, will have the option to assign each post an author.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom FIeld and the Loop?’ is closed to new replies.