<p>Try using the relatedTo() filter as explained here:</p>

<p><a href="http://buildwithcraft.com/help/entries-related-to-category" rel="noreferrer">http://buildwithcraft.com/help/entries-related-to-category</a></p>

<pre><code>{% paginate craft.entries.section('products').relatedTo(requestCategory).limit(9) as entriesOnPage %}
</code></pre>

CC BY-SA 3.0
2015-06-29T07:32:36.703Z
2015-06-29T07:32:36.703Z
j00lz
<p>Below is my paginate code and it's working fine.</p>

<pre><code>{% paginate craft.entries.section('products').limit(9) as entriesOnPage %}

{% for entry in entriesOnPage %}
    &lt;div class="product-box"&gt;
        &lt;div class="product"&gt;
            &lt;p class="product-name"&gt;
                &lt;a href="{{ entry.category.first().url }}"&gt;{{ entry.category.first().title }}&lt;/a&gt;
            &lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
{% endfor %}

{% if paginate.nextUrl %}
    &lt;a href="{{ paginate.nextUrl }}"&gt;Next&lt;/a&gt;
{% endif %}

{% endpaginate %}
</code></pre>

<p>Below is my code to display specific category data with pagination. and it's not working.</p>

<pre><code>{% set requestCategory = craft.request.getLastSegment() %}

{% paginate craft.entries.section('products').find({
    search: 'categories:' ~ requestCategory,
  }).limit(9) as entriesOnPage %}

{% for entry in entriesOnPage %}
    &lt;div class="product-box"&gt;
        &lt;div class="product"&gt;
            &lt;p class="product-name"&gt;
                &lt;a href="{{ entry.category.first().url }}"&gt;{{ entry.category.first().title }}&lt;/a&gt;
            &lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
{% endfor %}

{% if paginate.nextUrl %}
    &lt;a href="{{ paginate.nextUrl }}"&gt;Next&lt;/a&gt;
{% endif %}

{% endpaginate %}
</code></pre>

<p>i want to add category filter on that but not working how can i add a category filter?</p>

<filter><category>
Paginate with category filter?
# Paginate with category filter?

(Asked by: username_0 on 2015-06-29)

Below is my paginate code and it's working fine.
{% paginate craft.entries.section('products').limit(9) as entriesOnPage %}

{% for entry in entriesOnPage %}
    
        
            
                {{ entry.category.first().title }}
            
        
    
{% endfor %}

{% if paginate.nextUrl %}
    Next
{% endif %}

{% endpaginate %}

Below is my code to display specific category data with pagination. and it's not working.
{% set requestCategory = craft.request.getLastSegment() %}

{% paginate craft.entries.section('products').find({
    search: 'categories:' ~ requestCategory,
  }).limit(9) as entriesOnPage %}

{% for entry in entriesOnPage %}
    
        
            
                {{ entry.category.first().title }}
            
        
    
{% endfor %}

{% if paginate.nextUrl %}
    Next
{% endif %}

{% endpaginate %}

i want to add category filter on that but not working how can i add a category filter?

**Tags:** filter, category

---

## 1 answers

### Answer by username_1 on 2015-06-29. Score: 4 | Accepted answer

Try using the relatedTo() filter as explained here:
http://buildwithcraft.com/help/entries-related-to-category
{% paginate craft.entries.section('products').relatedTo(requestCategory).limit(9) as entriesOnPage %}


---

