• Resolved Andre Varinski

    (@andre-varinski)


    Hello,
    I’d like to know how to add the author’s name to a post, for instance under the post title, right after Posted on [date].
    I’ve tried many things, to no avail; the latest being dropping this line of code in single.php, under while ( have_posts() ) : the_post(); ?> (line 15) :
    <p>by <?php the_author(); ?></p>. The author’s name does appear, but over the post title, which looks a little awkward…
    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Andre Varinski

    (@andre-varinski)

    The author’s name does appear, but over the post title

    I meant above the post, not over. My bad!

    hello there,

    i just did a look to the theme you use and the author appear without any problem. the theme use a shortcode on the file :

    omega/partials/entry-byline.php :

    echo apply_atomic_shortcode( 'entry_author', __( 'Posted by [entry-author] ', 'omega' ) );

    So just leave it this way and remove what you add to single.php

    If you want to add the author on another place just insert : [entry-author] where you need !

    Thread Starter Andre Varinski

    (@andre-varinski)

    @templates4all:
    I followed your suggestion and removed the line of code I had added to single.php (by the way, I use a child theme of the Omega theme). The problem remains. Under the post title only this appears:

    Posted on October 21, 2013

    No author whatsoever. To be continued…
    Thanks anyways!

    Thread Starter Andre Varinski

    (@andre-varinski)

    @templates4all
    You put me on the right track! As a matter of fact, in omega/partials/entry-byline.php these lines of code can be found:

    if (is_multi_author()) {
    		echo apply_atomic_shortcode( 'entry_author', __( 'Posted by [entry-author] ', 'omega' ) );
    	} else {
    		echo apply_atomic_shortcode( 'entry_author', __( 'Posted  ', 'omega' ) );

    But as you can see, Posted by [entry-author] only applies (as I understand it) to multi-author websites, whereas mine is a single author site. I thus modified the code into this:

    if (is_multi_author()) {
    		echo apply_atomic_shortcode( 'entry_author', __( 'Posted by [entry-author] ', 'omega' ) );
    	} else {
    		echo apply_atomic_shortcode( 'entry_author', __( 'Posted by [entry-author] ', 'omega' ) );

    and bingo! that was it.
    Thanks again!

    ohh glad you made it, i really didn’t notice this. good job ??

    Thread Starter Andre Varinski

    (@andre-varinski)

    Well, thanks again for the hint. As a newbie, looking inside the omega/partials folder isn’t something I would’ve thought of in the first place! I’m still dabbling into code… bit by bit!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding author's name to post’ is closed to new replies.