Forums

Adding author to Lightword theme (5 posts)

  1. vukradic
    Member
    Posted 2 years ago #

    HI guys,

    i'm loving the Lightword theme. However, the way that the post author is shown is not done as elegantly as the rest of the theme. Is there a way to customize this theme somehow to have the author shown on the main page, right below the title and in as decent a way as possible (meaning just plain typography, no backgrounds, and in a size that is fitting).

    i am using WP 2.9.1 and the latest Lightword update. i appreciate the help

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    The WordPress Default theme has an example of the_author in the wp-content/themes/default/index.php but the code is 'commented-out' so it doesn't execute. So if you wanted to display the author info with the WordPress Default theme you would change the line in wp-content/theme/default/index.php
    from:
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    to
    <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> </small>

    Note the use of the template tag, the_author_posts_link(), which causes the author's name to be presented as a link to his/her posts.

    This also demonstrates the template tag, the_time(), which displays the date.

  3. JerMohler
    Member
    Posted 2 years ago #

    Hey folks,

    I'm also having the same problem.

    But I also want to add an avatar as well as author to my posts as I'll be sharing this blog with my wife. I would like to set it up so people know instantly when looking at the blog who posted what.

    I looked at the info you posted (MichaelH), but I'm not figuring out how to implement that with the lightword code. Any help would be greatly appreciated!

    Jeremy Mohler

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    In that theme's index.php change

    <span class="category"><?php if($lw_disable_tags

    to

    <span class="category">by <?php the_author_posts_link(); ?> <?php echo get_avatar($post->post_author,30); ?> <?php if($lw_disable_tags

    The above is line 18 in the version I'm using

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy
    Function_Reference/get_avatar
    Template_Tags/the_author_posts_link

  5. JerMohler
    Member
    Posted 2 years ago #

    Thank you MichaelH, I think I got it to work. Appreciate the help!

    Jer

Topic Closed

This topic has been closed to new replies.

About this Topic