• Currently, with my theme of choice (WP-Andreas01) I don’t have any byline on my posts. I want to add a byline, but I”m sure that when I do, it will go to the bottom with the rest of the post info. Is there a way to add a byline and make it post under my title?

Viewing 8 replies - 1 through 8 (of 8 total)
  • There’s a plugin called Add Signature that adds a signature to the end of posts. I have edited it for my own use to add the beginning of the post (after the title but before the post content). If you’d like I can send you my version.

    – Dave

    If this is just to add the author name to the post, just slip in:

    <?php the_author(); ?>

    right after where the post title appears in the template, typically in an <h2> element. Here’s what it looks like in the default theme:

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    Thread Starter daveconrey

    (@daveconrey)

    Ok, I tried it just like Kafkaesqui showed, but it didn’t work. Here’s the top half of the Single Post Template. I’m hoping that’s where it’s supposed to go, but look at this and let me know what I’m doing wrong.

    <?php get_header(); ?>
    <?php get_sidebar(); ?>

    <div id=”content”>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”post”>
    <h2><?php the_title(); ?></h2>
    <?php the_author(); ?> (this is what I added)

    <div class=”contenttext”>
    <?php the_content(‘<p>Read more »</p>’); ?>
    </div>

    I don’t see anything wrong with your code as shown above. At least, nothing that should cause a problem outputting the author of the post. To avoid X/HTML validation issues, you might want to place it in a <p> or <div> element, but that’s for later.

    You say your addition to the template didn’t work. So you’re not seeing anything between the post title and content on single post pages? Try a little change to the line:

    <p>Posted by <?php the_author(); ?></p>

    Then at least if you see the preceding text, we’ll know the change is occuring in the template.

    Thread Starter daveconrey

    (@daveconrey)

    ok, that worked. Thanks a ton.

    Heh, Kafkaesquí to the rescue again! Could you please mark this as “resolved” then?

    brooksr

    (@brooksr)

    I changed my Single Post template to:

    <h2>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></h2>
    <p> by <?php the_author(); ?></p>

    and there no change and the word ‘by’ did not appear.

    I notice the Main Index Template already has:

    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    I’m not sure why the author isn’t appearing either in the Main or Single page.

    Any help appreciated.

    Brooks

    I looked in the Main Index file, and my author code was commented out. It looked like this:

    <!– by <?php the_author() ?> –>

    It should look like this:

    by <?php the_author() ?>

    When I removed the <!– from the beginning and the –> from the end, it worked.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding Byline to posts’ is closed to new replies.