I've started using Solspace's Date Field Filter plugin. Is there any way to make the plugin show yearly headings? Something equivalent to EE's {date_heading display="yearly"}, which doesn't work with the plugin.

I've got a list of awards that I want to break up by date on a single page, e.g. 2013 winners, 2012 winners, etc.

The current work-around is to set the entry date as the award date, but I'd rather not do it that way (for a variety of reasons).

1 Answer 1


Date Field Filter works with the {exp:channel:entries} tag, so the native use of {date_heading} in {exp:channel:entries} should apply here. See the EE documentation. However, {date_heading} is for entry_date, not a custom Date field.

How about PHP for this then? Basically, display a heading when the first occurrence of a year is encountered, and store it in a PHP array to avoid displaying the same year again.

<?php $heading = array(); ?>
{exp:channel:entries /* your other parameters here, including Date Field Filter parameters */}

    <?php if( ! isset($heading['{my_date_field format="%Y"}']) ) :?>
        <h2>{my_date_field format="%Y"} winners</h2>
        <?php $heading['{my_date_field format="%Y"}'] = '{my_date_field format="%Y"}'; ?>
    <?php endif ?>

    // Your other code

  • Excellent. Tested it out and it works. Thanks. Edit: For anyone else trying this - note that you do have to turn on the "allow php" in EE's template manager.
    – SamC
    Nov 27, 2013 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.