• Resolved hugobs

    (@hugobs)


    hi,
    i am using Nurelm get posts plugin. i have a problem with my date format:

    [get_posts tag=”eu” tag=”press-release” numberposts=100 fields=”post_title, post_date” orderby=”date”]

    returns me a list of posts that look like:

    – Release of EU report2010-05-19 13:20:34

    whereas i would like them to look like:

    – Release of EU report, 19 May 2010

    what do i have to change?
    thanks a lot!

Viewing 6 replies - 1 through 6 (of 6 total)
  • MichaelH

    (@michaelh)

    Probably need to change the date ‘format’ the plugin uses with the_time() (or the_date()).

    If you can’t figure it out, leave a link to the plugin so I can tag this thread so the plugin author might be able to find it.

    Thread Starter hugobs

    (@hugobs)

    hi, thanks for the reply. i still cant make this work :(.

    below is the .php of the plugin, which can be found here: http://ww.wp.xz.cn/extend/plugins/nurelm-get-posts/

    thanks a lot

    [code moderated use a pastebin such as wordpress.pastebin.com in the future, please]

    MichaelH

    (@michaelh)

    From the comments listed under that Plugin’s Homepage WuLongTi has a fix to format the date:

    if you change this code:

    $field = trim($field);
    $content = $content . $post->$field;

    to this code:

    if (trim($fields_list[$i])==’post_date’){
    $field = trim($field);
    $dateFormat = ‘l F j, Y’;
    $content .= mysql2date($dateFormat, $post->$field);
    }else{
    $field = trim($field);
    $content = $content . $post->$field;
    }

    then you can reformat the date however you like.

    Thread Starter hugobs

    (@hugobs)

    it works! now, i just need to solve a small detail:
    i would like to have a comma and a space between the title and the date, i.e.:
    Release of EU report, May 19, 2010
    instead of
    Release of EU reportMay 19, 2010
    any clue on how to do this?
    many thanks!

    MichaelH

    (@michaelh)

    You could probably do that in your date format
    something like:

    ', l F j, Y'

    note the beginning comma and space (work that into whatever format you used)

    Thread Starter hugobs

    (@hugobs)

    that worked, thanks a million.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: Get Posts] date format issue’ is closed to new replies.