How to filter news articles using date range kentico

In Kentico, you can filter news articles using a date range by creating a custom query or using the built-in filtering options. Here are a steps to achieve this:

Method 1: Using the built-in filtering options

  1. Go to the News module in your Kentico instance.
  2. Click on the "Filter" button at the top of the page.
  3. In the "Filter" dialog box, click on the "Date" tab.
  4. Select "Date range" as the filter type.
  5. Choose the "Published date" or "Modified date" field as the date field to filter on.
  6. Enter the start and end dates for the date range you want to filter by.
  7. Click "Apply" to apply the filter.

Method 2: Using a custom query

  1. Go to the News module in your Kentico instance.
  2. Click on the "Query" button at the top of the page.
  3. In the "Query" dialog box, click on the "Add condition" button.
  4. Select "Date" as the condition type.
  5. Choose the "Published date" or "Modified date" field as the date field to filter on.
  6. Select "Between" as the operator.
  7. Enter the start and end dates for the date range you want to filter by.
  8. Click "Apply" to apply the query.

Method 3: Using a macro

  1. Go to the News module in your Kentico instance.
  2. Click on the "Query" button at the top of the page.
  3. In the "Query" dialog box, click on the "Add condition" button.
  4. Select "Macro" as the condition type.
  5. Enter the following macro code: {{ NewsItem.PublishedDate >= '{0}' && NewsItem.PublishedDate <= '{1}' }}
  6. Replace {0} and {1} with the start and end dates for the date range you want to filter by.
  7. Click "Apply" to apply the query.

Method 4: Using a custom web part

  1. Create a new web part in your Kentico instance.
  2. In the web part, add a "News" data source.
  3. In the data source, add a "Filter" property and set it to "Published date" or "Modified date".
  4. In the filter property, enter the start and end dates for the date range you want to filter by.
  5. Add the web part to your page and configure it as needed.

These are the different ways you can filter news articles using a date range in Kentico. The method you choose will depend on your specific requirements and the complexity of your filtering needs.