ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How do I output all entries belonging to one of the current entry’s categories?

February 15, 2012 2:13pm

Subscribe [2]
  • #1 / Feb 15, 2012 2:13pm

    How do I output all entries belonging to one of the current entry’s categories? An entry can be assigned to multiple categories.

    For example: our policy entry assigned to “About” and “Policies” categories, all other entries (such as privacy policy, security policy belong to “policies” category) should be displayed on the side.

    How can I implement it without any addon?

    Thanks

  • #2 / Feb 15, 2012 4:14pm

    Ian Young

    200 posts

    So for the current entry being viewed you want to display a list of entries in the same categories (all categories it belongs to)?

    This sounds like it’s a better fit for related entries where you can specify related entries per entry.

    It could be tricky using categories, especially if you don’t want to use any plugins. You’d probably have to write a custom query and output the results inside the Channel Entries tag.

    Take a look at related entries and see if that would work for you in your situation. If not then it would either be to a plugin or a custom query for categories so post back if you need further help.

  • #3 / Feb 16, 2012 3:27pm

    Dan Decker

    7338 posts

    Hi cpsadministrator,

    I’m going to agree with Slippy on this one. Related entries would be a better fit overall.

    Without hard-coding the category id you wanted to pull entries from, it would be a bit difficult to get only those entries.

    If you will consider using an add-on, have a look at Primary Category. By assigning a “primary” category, in your example “policies”, you can use the special variables that Primary Category provides to limit a list to return those entries.

    Let me know if you have any questions.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases