WordPress.org

Ready to get started?Download WordPress

Forums

Omega
[resolved] Adding author's name to post (7 posts)

  1. Andre Varinski
    Member
    Posted 9 months ago #

    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!

  2. Andre Varinski
    Member
    Posted 9 months ago #

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

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

  3. templates4all
    Member
    Posted 9 months ago #

    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 !

  4. Andre Varinski
    Member
    Posted 9 months ago #

    @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!

  5. Andre Varinski
    Member
    Posted 9 months ago #

    @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!

  6. templates4all
    Member
    Posted 9 months ago #

    ohh glad you made it, i really didn't notice this. good job ;)

  7. Andre Varinski
    Member
    Posted 9 months ago #

    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!

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.