Support » How-To and Troubleshooting » put the_date in ul with format in li’s

put the_date in ul with format in li’s

  • hi there, i’m trying to tweak the_date and wrap it in a ul but my script doesnt seem to work

    //parse date to list
    $mydate = the_date("M.d.y");
    print("<ul class=\"datelist\">n");
    $tok = strtok($mydate, ".");

    $the_dateloopnum = 1;
    while ($tok) {

    $dateclass = "month";
    $dateclass = "day";
    $dateclass = "year";

    print("<li class=\"$dateclass\">$tok</li>n");
    //below closes date token
    $tok = strtok(".");

    it outputs the date outside of the ul and doesnt print the li’s either…. like:

    Apr.25.05<ul class="datelist">

    anyone see whats wrong?

    thanks alot….

Viewing 6 replies - 1 through 6 (of 6 total)
  • $mydate = the_date("M.d.y", "", "", FALSE);

    See the info on the echo parameter for the_date():


    excellent kafkaesqui

    I was reading that page actually all nite and forgot to put that piece into the script…

    thanks a ton!

    rats… thought it was sussed…

    for some reason my script above doesnt work like the_date
    as it should- (only showing the date on the first post when there are multiple posts on one day)…

    on days with more than one entry my script writes an empty
    <ul class="datelist">

    which throws off the validation of my site…..

    is there something that needs to be added in my script so that it behaves as the_date by default on multiple posts?

    still havent been able to figure this one out, help much appreciated 🙂

    Again I direct you to the Codex page, this time the description section:


    “When there are multiple posts published on the same date on a page, the tag will only display the date the first time it’s called.”

    So try this:

    $mydate = get_the_time("M.d.y");


    thanks kafka, i’m still a noob at php so it takes me a bit to get a hold of what to do,

    i know about the tag only the first time its called, thats what i was expecting my script above to do, but it wasnt doing that.

    this you posted works, it actually puts a date on every entry which is fine, I just wondered why the original the_date in my script wasnt working….

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘put the_date in ul with format in li’s’ is closed to new replies.