I need to create a View that will display a banner for a specific month (regardless of the year).

I create a field for that called, DisplayMonth, which holds an integer (so September is 9).

I would like for that banner image to change automatically for 2014. Any september month, no matter what year, it will display the record with DisplayMonth = 9.


Create a contextual filter against the field that holds the month number. Provide a default value of PHP code:

return date('n');

Now only those nodes will display in September that have 9 as the month number.

  • The date() function without the timestamp always returns the current date: return date('n'); will work fine.
    – Triskelion
    Sep 11 '13 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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