Dec 122013
 

List Layout with dates for How To's categoryThe default Suffusion list layout for categories, tags or other aggregate pages is just an unordered list of post titles without anything else. But sometimes is needed to add more information’s, usually the date of publishing.

The solution is simple and the goal can be achieved with a new template. Better is to use a child theme – by editing templates in child theme is safer than editing the theme core files, but most important, your templates will be preserved and will continue to work in case of theme updates. See this post for making a child theme in practically no time. After creating your child theme follow the next easy steps:

Step. 1. Create a /layouts/ subfolder under your child theme folder.

Step. 2. Copy layout-list.php from /suffusion/layouts/ folder to your child theme /layouts/ subfolder.

Step. 3. Edit the copy and look for the loop which generate the list markup (somewhere close to the end of file):

Inside the <li> tag which surround the title of post, immediately after echo suffusion_get_post_title_and_link(); add a new function: echo “&nbsp;” . get_the_date($d); – so the entire <li> tag will look as:

Step. 4. Save the file.

Step. 5. Done. Can select the list layout, now with dates, at Suffusion Options -> Layouts -> each view of aggregate pages (Category Views, Tag Views etc.).

Can download the modified template (and upload it into /layouts/ subfolder on your site) from here: Download the new layout-list.php template

Of course, instead of get_the_date() function can use any of WordPress functions for retrieving dates and not only dates (look at the end of Codex page for related functions).

The above solution was also published in reply to a question of an user on the Suffusion Support forum, but I put here also for further reference and to be easier to retrieve it.