WordPress.org

Support

Support » How-To and Troubleshooting » Add date and author’s name

Add date and author’s name

Viewing 11 replies - 1 through 11 (of 11 total)
  • Date and author are auto-added by your theme but only if it is coded this way…

    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.

    Hi,

    To add Date and Time stamp in wordpress we need to modify index.php file of the current active theme. Please check the code here:

    Date and Time Code

    For author add this code in index.php file of your theme where you want to display the author name:

    <?php the_author() ?>

    Thanks,

    Shane G.

    Hi MichaelH- did what you said, but it still doesn’t show in the posts…..
    Plus this is my index.php file of the current active theme I am using

    <?php get_header(); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post();
    $thumb = get_post_meta($post->ID, ‘Thumbnail’, $single = true);
    ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <div class=”pic fl”>
    <?php if($thumb !== ”) { ?><?php the_author() ?>
    ” title=”<?php the_title(); ?>”><img src=”<?php echo $thumb; ?>” alt=”<?php the_title(); ?>” />
    <?php } else { echo ”; } ?>
    </div>
    <p class=”meta-nfo”><?php the_author_posts_link(); ?>  /  <?php the_category(‘, ‘) ?>  /  <?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></p>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <div class=”fix”></div>
    </div>

    <?php endwhile; ?>

    <?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    You have this code that may be causing it not to execute the code you entered:

    <?php if($thumb !== '') { ?><?php the_author() ?>

    So you might want to change the_author to the_author_posts_link and add the_time in there.

    If you continue this thread, please provide a link to see the problem.

    Okay- did what you said and still not working- heres the code

    <?php get_header(); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post();
    $thumb = get_post_meta($post->ID, ‘Thumbnail’, $single = true);
    ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <div class=”pic fl”>
    <?php if($thumb !== ”) { ?><?php the_author_posts_link() ?><?php the_time(‘F jS, Y’) ?>
    ” title=”<?php the_title(); ?>”><img src=”<?php echo $thumb; ?>” alt=”<?php the_title(); ?>” />

    <?php } else { echo ”; } ?>
    </div>
    <p class=”meta-nfo”><?php the_author_posts_link(); ?>  /  <?php the_category(‘, ‘) ?>  /  <?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></p>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <div class=”fix”></div>
    </div>

    <?php endwhile; ?>

    <?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    And heres the link

    Didn’t let me post that link……..so heres the address
    http://www.addictivehobby.com/wordpress/

    Looks okay to me.

    admin  /  Uncategorized  /  1 Comment

    I am trying to get the date and Authors name like this
    http://psd.tutsplus.com/
    The red bit !

    So rearrange things so it’s like:

    the_time  the_category  the_author_posts_link

    Review the_time() and Formatting_Date_and_Time

    I’d like to add the author’s Name, not Username. Those are the labels used in the User dialog.

    e.g. If Joe Blow is the Name and joe1982 is his Username, the_author displays joe1982 which is not very useful. Is there any way to show his Name? I have a site with several contributing authors, so showing their real names with the post is better than revealing their login names.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Add date and author’s name’ is closed to new replies.
Skip to toolbar