EE 2.7.2 Build20131008
I am fairly new to expression engine and having a little bit of trouble getting this to work out the way I need it.
I am trying to create a category archive page. Here is the code I have so far:
{exp:channel:category_heading}
<h2>Careers in {category_name}</h2>
{/exp:channel:category_heading}
{exp:channel:categories channel="careers" category="{category_id}" style="linear"}
<ul>
{exp:channel:entries channel="careers" category="{category_id}" orderby="date" sort="desc" disable="member_data" dynamic="no"}
<li>
<a href="{url_title_path='careers'}">{title}: ({career_location})</a>
</li>
{/exp:channel:entries}
</ul>
{/exp:channel:categories}
The issue I have is that is doesn't seem to be pulling the "category_id" in the channel:entries tag. So I currently have 2 posts, both are assigned to 2 categories. So it actually renders a list of 4 posts, instead of just 2.
More Details
Here is a full layout of how things are setup:
Careers Channel with 2 category groups - location and department.
_desktop/careers pulls the careers listing. Currently have a select/dropdown on that page.
<form name="catmenu" action="">
<select name="selcat" onchange="location=document.catmenu.selcat.options[document.catmenu.selcat.selectedIndex].value;">
<option value="">--Select Category--</option>
{exp:channel:categories channel="careers" category_group="2" style="linear"}
<option value="{path='careers/listing'}/{category_id}">{category_name}</option>
{/exp:channel:categories}
</select>
</form>
I created the careers/listing template as a "landing page" for when a category is selected. So lets say you select "Jobsville, NY" from the dropdown, it points to the careers/listing template with this URL:
domain.com/careers/listing/C37
Jobsville category id is "37". I can't figure out how to get it to spit out /careers/listing/category_name either.
On this listing page is where I have the code from the first part of my question. I currently have 2 posts.
- Post 1 - assigned to location 1 and department 2
- Post 2 - assigned to location 2 and department 2
The listing page is showing 2 copies of each post - not limiting the list to the category that I am currently viewing.