WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#225 closed enhancement (fixed)

wp_list_cats uses hardcoded date format

Reported by: adam Owned by: matt
Milestone: Priority: normal
Severity: normal Version: 1.2
Component: Template Keywords:
Focuses: Cc:

Description

It seems that

wp_list_cats('optiondates=1');

Appends the date in only European format (date/month), rather than using an option. It looks like the format is hardcoded in the function.

Attachments (1)

0000225-optionsdate-patch.diff (2.9 KB) - added by adam 9 years ago.

Download all attachments as: .zip

Change History (4)

comment:2 chuyeow10 years ago

Hi there devs!

I've uploaded a patch that adds a 'optiondatesformat' parameter to the wp_list_cats() function (and consequently also to the list_cats() function which is called from wp_list_cats()). This query will take in a PHP date() function type format string (default is 'j/m' - the currently used hard-coded format).

So, as an example, you can print the list of categories like so:
<?php wp_list_cats('optiondates=1&optiondatesformat=j M'); ?>

Granted, 'optiondatesformat' is a tad lengthy so another variable name may be more prudent.

comment:3 matt9 years ago

  • fixed_in_version set to 1.3
  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed

optiondates can now be a php.net/date formatted string.

Note: See TracTickets for help on using tickets.