I hope someone can help me with this. I am using Mobilia theme and I am trying to display only 8 items in the first page. I was hoping by adding this line ( { % for content in pages[settings.featured_content_page].content limit:8 offset:0 % }) into theme.liquid would give me the expected result. But, it didn't work. Any help would be appreciated.
{% if settings.featured_content_page != blank %}
<div class="sixteen columns alpha omega">
<div class="section clearfix featured_content">
{ % for content in pages[settings.featured_content_page].content limit:8 offset:0 % }
{{ pages[settings.featured_content_page].content }}
{ % endfor %}
</div>
</div>
{% endif %}
Your loop is a little messed up, but we'll fix it. It looks like you are trying to loop over a single page but that's not going to work for you. If you are trying to show items from a collection you would loop over a collection and not a page.
{% for product in collections.frontpage.products limit:8 %}
{{ product.title }}
{% endfor %}
See the collection page for more info.
Hi Jason,
Thank you for your reply. The following piece of code is working correctly, but I am trying to limit the number of items.
{{ pages[settings.featured_content_page].content }}
I have also tried to add the handle (art) with the following code but no luck.
{% for product in collections.art.products limit:8 %}
{{ pages[settings.featured_content_page].content }}
Each page has one piece of content (the text entered into the editor) and that's what you pulling out here.
If you do have a collection with the handle of art this will do something.
{% for product in collections.art.products limit:8 %} <h2>{{ product.title }}</h2> {{ product.description }} {% endfor %}
Check out the product wiki -- it will give you an idea of the variables you have access to for products.
<img src="{{ product.featured_image | product_img_url: 'small' }}" />
User | Count |
---|---|
545 | |
209 | |
125 | |
79 | |
42 |