Get entries from client checked options I have a checkbox field to enable my client to choose what entry categories to have as an article feed on a page. How can I output the checked option categories when setting the entries in the for loop? Below is what I have done to return the checked option's value but what I want to do is use the checked options value to filter through entry categories.

What I'm looking to do is set the entries as below:

{% set entries = craft.entries.relatedTo(category, 'checkedOptionValue','checkedOptionValue','checkedOptionValue').limit(10).find() %}

&lt;!-- This is returning the checked options value --&gt;
{% for option in checkboxFieldHandle.options %}
    {% if option.selected %}
        {{ option }}
    {% endfor %}
{% endfor %}


Any help would be greatly appreciated
The most straightforward way would be to use a Categories field.

The value that a Categories field returns to the template is an ElementCriteriaModel, which fits perfectly as a value for the .relatedTo parameter.

So you could do something like:

{% set featuredEntries = craft.entries.relatedTo( entry.selectedCategories ) %}


The only circumstance where I can envision a Checkboxes field being better suited to this use-case is if you need to only provide a specific subset of the categories in a group.

(If you want to make all the categories from a group available for selection, using a Categories field is definitely best; otherwise you have to go back and update the options of your Checkboxes field every time a category is created, changed, or deleted.)

In that case, I recommend using the category IDs as the option values for your checkboxes, so that you can pass them to an ElementCriteriaModel like this:

{% set featuredEntries = craft.entries.relatedTo( entry.selectedCheckboxes | join ) %}