View Categories

Custom Template Placeholders Reference

When you set Template type to Custom in Related Categories for WooCommerce, you write your own markup for each related category and drop in placeholders that the plugin replaces per category. This reference lists every available placeholder.

The Custom template lives at WPFactory > Related Categories (also reachable at WooCommerce > Settings > Related Categories), under Template Options on the Single or Archives sub-tab. Set Template type to Custom, then enter your markup in Template type: Custom. The same placeholders are available in the widget’s Template field.

Placeholders #

Placeholder Replaced with
%category_name% The category name.
%category_description% The category description.
%category_count% The number of products in the category.
%category_link% The URL to the category archive.
%category_image_link% The URL of the category thumbnail (or the placeholder image if none is set).
%category_image_id% The attachment ID of the category thumbnail.
%category_id% The category term ID.
%category_slug% The category slug.
%column_nr% The column number of the current item, based on the Columns setting.
%is_active% Archives only: outputs active for the current category, otherwise empty.

%is_active% is available on the Archives sub-tab (the loop context) only. All other placeholders work in both the Single and Archives Custom templates.

Examples #

A simple linked list item:

<li><a href="%category_link%" title="%category_name%">%category_name%</a></li>

A card with the image, name and product count, using the column number as a class:

<div class="cat-card column-%column_nr%">
  <a href="%category_link%">
    <img src="%category_image_link%" alt="%category_name%">
    <span class="name">%category_name%</span>
    <span class="count">%category_count%</span>
  </a>
</div>

On archives, mark the current category with the active flag:

<a class="%is_active%" href="%category_link%">%category_name%</a>

Use Template type: Custom: Glue to set a separator placed between items, for example a pipe. To place a separator between items inline, set the Glue value rather than adding it inside the template.

Need a hand? #

Our team answers every ticket on the Related Categories support forum.