1

I'm having some trouble with the {category="not 8"} for example. On my page I have two categories that a user might check when publishing a new entry. It's "show on front page" and "do not show facebook comments". Based on these, I want to exclude these entries on certain places.

On the front page, I want to exclude categories with category_id 8. If the entry has only category 8 checked, this works. However, if both category 8 and 9 are checked, this doesn't work.

On the article layout, I want to exclude category 9 if it's checked. This should hide facebook comments. However, same thing happens here. If the entry has both category 8 and 9 checked, this doesn't work.

Any ideas? How do you guys solve these kind of things? I'm guessing this is something you should see quite often?

1 Answer 1

2

Yeh, it's a common and rather unintuitive problem. In your particular scenario, I'd say your use-case doesn't semantically fit well with the category system anyway: why not just use custom checkboxes? Even better, use the 'checkbox group' field provided in the PT Field Pack instead of the native ones, as they allow you to separate the value from the name. Much easier... http://devot-ee.com/add-ons/field-pack

Then in your channel:entries tags you can use the search parameter to examine the values of your options and filter accordingly - something like this:

{exp:channel:entries search:article_options="show_on_hp"}
   <h2>{title}</h2>
{/exp:channel:entries}

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.