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.

Show Categories

February 02, 2011 5:29am

Subscribe [2]
  • #1 / Feb 02, 2011 5:29am

    Chris Wareham

    40 posts

    Hello,

    My name is Chris Wareham and I am trying to display a list of titles from a particular channel that are attributed to certain categories.

    IE channel of teachers with a category id of 2 AND 7 (ie both 2 and 7)... i tried the following but it did not work correctly.

    {exp:channel:entries channel="teachers" status="Homepage Featured|Homepage Secondary|open" limit="4"}
                    {categories show="2|7"}
                    <li><a href="http://{title_permalink=teachers/products}">{title}</a></li>
                    {/categories}
                {/exp:channel:entries}

    You can view the work-in-progress at:

    http://www.geraldwood.com/teachers/
    (scroll down to Edexcel Business Studies Products for Teachers)

    It is not currently working properly, is allowing duplicate entries and is ignoring the limit=“4”.

    I am sure there is a much easier way of doing this than my code? Any help would be much appreciated!

    Chris W

  • #2 / Feb 02, 2011 5:49am

    captaink

    43 posts

    Hi Chris,

    Try this:

    {exp:channel:entries channel="teachers" status="Homepage Featured|Homepage Secondary|open" category="2|7" limit="4"}
  • #3 / Feb 02, 2011 6:13am

    Chris Wareham

    40 posts

    Captaink - thank you so much for your quick reply. That’s amazing.

    I have made the changes - the only hurdle left is that it seems to be pulling in titles of either 2 OR 7 rather than titles of both 2 AND 7.

    Chris W

  • #4 / Feb 02, 2011 6:23am

    captaink

    43 posts

    Use 2&7 rather than 2|7.

  • #5 / Feb 02, 2011 2:06pm

    Chris Wareham

    40 posts

    Hello,

    Thanks again - that was just what I needed!!! Tried to solve it myself for a good few hours - always better to ask for help! Much appreciated!

    Chris W

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

ExpressionEngine News!

#eecms, #events, #releases