Skip to content

getBlogCategories(int items_per_page)

The getBlogCategories method is used to get a BlogCategoriesList object that represents a list of all blog categories in the storefront.

Input parameters

items_per_page

int Number of items on a page of internal paginator. Parameter is optional. Default value is 100.

Returned value

The BlogCategoriesList object.

Example

source
{% set categories = ObjectApi.getBlogCategories() %}
{% for category in categories %}
<a href="{{ category.url }}" title="{{ category.name}}">
    {{ category.name }}
</a>
{% endfor %}
output
<a href="/en/n/category/top-news/1" title="Top news">
    Top news
</a>
<a href="/en/n/category/sales/2" title="Upcoming sale calendar">
    Upcoming sale calendar
</a>