WordPress.org

Ready to get started?Download WordPress

Forums

Adding published date just before post ... (10 posts)

  1. Revived
    Member
    Posted 3 years ago #

    How do you add the published date just before a post ... within the first <p> tag?

  2. MichaelH
    Member
    Posted 3 years ago #

    one example

    <p><?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>

    Also see the_time() for more formatting choices

  3. Revived
    Member
    Posted 3 years ago #

    To clarify, I meant having the date just before the body of the post, not the title.

    For instance:

    <h2>Here's the title of the post</h2>

    <p>(DATE) - And here's the post body ...</p>

    <p>Another paragraph ...</p>

    <p>...</p>

    Comments area

  4. MichaelH
    Member
    Posted 3 years ago #

    So find where the_content() is used and put something like

    <?php the_time('m.d.y') ?>
  5. Revived
    Member
    Posted 3 years ago #

    I've searched for every instance of the_content() and I cannot figure out how to make the date appear where I've illustrated above. Can you be more specific?

  6. MichaelH
    Member
    Posted 3 years ago #

    With the help of the Template Hierarchy article, determine what Template is displaying your posts (could be your theme's index.php).

    Then look for the template tag, the_content().

    If you are not currently displaying the whole post content then you may not find the_content.

    If necessary use http://wingrep.com on a local copy of your theme to find the_content.

  7. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

  8. Revived
    Member
    Posted 3 years ago #

    Alchymyth,

    Would would that be placed?

  9. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    instead of <?php the_content(); ?>
    in each template file of your theme where you want to show this construct - index.php, single.php, archive.php .. (?)

  10. Revived
    Member
    Posted 3 years ago #

    Unfortunately, that didn't work. It placed the date before the first <p> tag:

    (Oct.22.2010) –
    <p>

    Is there a way to force it just before that opening <p>?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.