Filter content by a custom field

Content Views Pro helps you to filter content by a custom field easily. Here is a sample to filter upcoming events:

CVP - filter by custom field

To filter by a custom field, in “Filter Settings” tab, select the Custom Fields checkbox. In the “Filter by Custom Fields” box, click “Add New” button, then:

  • select the name of custom field for “Field Key”
  • select the “Value Type” of the field. Available options are:
    • Text
    • Number
    • Decimal
    • Date
    • Date Time
    • True/False
  • select option to compare in “Operator To Compare” setting. There are many options which work for all your needs:
    • Today
    • Now & Past
    • Now & Future
    • In the past
    • Equal ( = )
    • Differ ( != )
    • Greater ( > )
    • Greater or Equal ( >= )
    • Less ( < )
    • Less or Equal ( <= )
    • Exists
    • Not Exists
  • select the value for “Value To Compare” if needed. Some of above options don’t require value.

Notice:

With Content Views Pro version 5.3.3.2 and before, filter by a date custom field only supports field which has value in YYYY-MM-DD (year-month-date) format.
If the field doesn’t has that format, you will need to create an alias field.

Assuming you have some events, each event has a custom field “Start Date”. Value of these custom fields are somethings like 10 Sep 2015, 9 Oct 2015…
ctfield1
Because value of this field is not in format YYYY-MM-DD, we have to create a new custom field (read more here):
– give it a custom name (for example: cvp_start_date)
– convert value of the field “Start Date” to YYYY-MM-DD format, to set as value of this field. For example, the value of “Start Date” is “10 Sep 2015”, so value of the alias field is “2015-09-10”.
ctfield2

Best regards,