WordPress.org

Ready to get started?Download WordPress

Forums

the_date formating with <span> (8 posts)

  1. Oisin
    Member
    Posted 10 years ago #

    In your index.php file, there is the following line (if you haven't changed it; this is the out-of-the-box version of index.php):
    <?php the_date('','<h2>','</h2>'); ?>
    That will create the following HTML for you:
    <h2>Saturday 5th June 2004</h2>
    In your style sheet, you can modify the settings for the h2, or you can change the the_date() call in your index.php to add a span that you can modify in your style sheet. To add a span in your index.php, just replace the code above with:
    <?php the_date(",'<h2><span>','</span></h2>'); ?>

  2. Beel
    Member
    Posted 10 years ago #

    I can't think of a way without hacking the code.

  3. somefool
    Member
    Posted 10 years ago #

    yes, im aware of <span> within <h2> around the date - just not on a specific portion of the date - maybe some enterprising WP plugin writer would be kind enough ;-)
    i did have a look at the the_date function, but i couldnt see how to alter it.

  4. Beel
    Member
    Posted 10 years ago #

    I suspect you would have to write something to filter the date through - a bit much I would think.

  5. somefool
    Member
    Posted 10 years ago #

    oh well.

  6. Nick Momrik
    Member
    Posted 10 years ago #

    Do you still want the date to only appear once for each day? If you don't mind it appearing for each post, you could use the_time instead, calling it twice each time. Once for the day of the week which you could style and then once for the rest of the date.
    http://wiki.wordpress.org/the_time
    http://wiki.wordpress.org/the_date

  7. Anonymous
    Unregistered
    Posted 10 years ago #

    yeah, separate calls are the way to go. just feed the relevant parameters into the function calls as per the wiki.

  8. Nick Momrik
    Member
    Posted 10 years ago #

    Good idea Oisin...I never thought of passing the "span" through to the_date function. Pretty slick!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.