Answers.Body: <p>I suggest changing the couple places where you use getParam('offerCategory') to getParam('category') so it matches the parameter set in the URL. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-27T03:50:51.033Z
Answers.LastActivityDate: 2015-08-27T03:50:51.033Z
Answers.UserDisplayName: Anna_MediaGirl
Body: <p>I've been trying to build a category filter. I managed to make my buttons respond with categories but the returned entries on the page stay the same. So when I click one of the links "/?category=koop" gets added to the URL, but my entries don't respond upon that URL. I do have added the categories in the CP and assigned them to my entries. </p>
  
  <p>Here is the code of my filters:</p>
  
  <pre><code>{% if craft.request.getParam('offerCategory') is not null %}
  
      {% set offerCategory = craft.categories.slug(craft.request.getParam('offerCategory')) %}
      {% set offers = craft.entries.section('offers').relatedTo(offerCategory).find() %}
  
  {% else %}
  
      {% set offers = craft.entries.section('offers').find() %}
  
  {% endif %}
  </code></pre>
  
  <p>And my button list</p>
  
  <pre><code>{% for offerCategory in craft.categories.group('offerTypes').find() %}
      &lt;li&gt;
          &lt;a class="mart-button" href="{{craft.request.url}}/?category={{ offerCategory.slug }}"&gt;{{ offerCategory.title }}&lt;/a&gt;
      &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>I'm quite new to Craft. One of the resources I'm using to build this is: <a href="http://craftcookbook.net/recipes/197" rel="nofollow">http://craftcookbook.net/recipes/197</a>. </p>
  
  <p>If anyone knows what I'm overseeing, thanks in advance.</p>
  
Tags: <categories><relations><filter><category>
Title: Category filter returning all entries
ThreadText: # Category filter returning all entries
  
  (Asked by: username_0 on 2015-08-26)
  
  I've been trying to build a category filter. I managed to make my buttons respond with categories but the returned entries on the page stay the same. So when I click one of the links "/?category=koop" gets added to the URL, but my entries don't respond upon that URL. I do have added the categories in the CP and assigned them to my entries.
  
  Here is the code of my filters:
  
  ```
  {% if craft.request.getParam('offerCategory') is not null %}
  
      {% set offerCategory = craft.categories.slug(craft.request.getParam('offerCategory')) %}
      {% set offers = craft.entries.section('offers').relatedTo(offerCategory).find() %}
  
  {% else %}
  
      {% set offers = craft.entries.section('offers').find() %}
  
  {% endif %}
  
  ```
  
  And my button list
  
  ```
  {% for offerCategory in craft.categories.group('offerTypes').find() %}
      <li>
          <a class="mart-button" href="{{craft.request.url}}/?category={{ offerCategory.slug }}">{{ offerCategory.title }}</a>
      </li>
  {% endfor %}
  
  ```
  
  I'm quite new to Craft. One of the resources I'm using to build this is: <http://craftcookbook.net/recipes/197>.
  
  If anyone knows what I'm overseeing, thanks in advance.
  
  **Tags:** categories, relations, filter, category
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-27. Score: 3 | Accepted answer
  
  I suggest changing the couple places where you use getParam('offerCategory') to getParam('category') so it matches the parameter set in the URL.
  
  
  ---
  
  