Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5079

    Hello – I’d like to add “by <author” piece of text to each post’s entry head right next to the comment count and category.

    Screenshot of a photoshoop that explains what I’m trying to do:

    http://imgmi.net/c/c0e8a4a4.png

    I know the fix would involve adding another entry to this piece of code on basically every page that displays posts:

    <div class=”entry-head”>

    <span class=”comments”><?php comments_popup_link(__(‘No Comments’,’habitat’), __(‘1 Comment’,’habitat’), __(‘% Comments’,’habitat’)); ?></span>

    <span class=”categories”><?php the_category(‘, ‘); echo $terms; ?></span>

    </div>

    I think a new CSS rule would need to be created. Can anyone help me out with how to do this?

    #48784

    Hey,

    you can use this function: http://codex.wordpress.org/Function_Reference/the_author to display the author.

    Use it like:

    <span class="author"><?php the_author(); ?></span>

    #48785

    Thanks! One other question – how do I get a little icon next to that line, like the category and comment count have?

    #48786

    1) You need to add your new element to following code in style.css:

    .entry-head .comments, .entry-head .categories, .tag_list .the_tags{
    display:block;
    float:left;
    padding-left:20px;
    }

    2) You need to add an icon – you can use the comments code with a different image – the code can be found in style1.css:

    .entry-head .comments{
    background:url("../images/shared/icon_comment.png") no-repeat scroll left center transparent;
    }

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Add "by Author" to post entry head’ is closed to new replies.