1. Documentation /
  2. Storefront Hooks: Actions and filters

Storefront Hooks: Actions and filters

Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.
This document lists the Actions and Filters which are available within the Storefront theme. For a full list of template actions which add the default content in Storefront, you can find a comprehensive list of these within the file/storefront/inc/storefront-template-hooks.php inside the theme folder.

Examples

↑ Back to top
To get familiar with the Storefront hooks it might be good to have a look at some tutorials:

Actions reference guide

↑ Back to top
All available add_action() functions used on the Storefront theme are listed below. To add content before an existing action, you can adjust the ordering position by decreasing the actions priority numerically. To add content after and existing action, you would then increase the action priority. You can read more about add_action() and what parameters can be used on the WordPress Developer Resources site here.

General

↑ Back to top
  • storefront_before_site – Executed after opening <body> tag
  • storefront_before_content – Executed before opening <div id="content"> tag
  • storefront_content_top – Executed after opening <div id="content"> tag

Header

↑ Back to top
  • storefront_before_header – Executed after <div id="page"> tag
  • storefront_header – Executed inside <div class="col-full"> of the <header id="masthead"> tag

Homepage

↑ Back to top
  • storefront_homepage – Executed inside <div class="col-full"> of the homepage content section

Product categories

  • storefront_homepage_before_product_categories – Executed before the <section class="storefront-product-categories"> homepage section
  • storefront_homepage_after_product_categories_title` – Executed after the <h2 class="section-title"> product categories section title
  • storefront_homepage_after_product_categories – Executed after the <section class="storefront-product-categories"> homepage section

Recent products

  • storefront_homepage_before_recent_products – Executed before the <section class="storefront-recent-products"> homepage section
  • storefront_homepage_after_recent_products_title – Executed after the <h2 class="section-title"> recent products section title
  • storefront_homepage_after_recent_products – Executed after the <section class="storefront-recent-products"> homepage section

Featured products

  • storefront_homepage_before_featured_products – Executed before the <section class="storefront-featured-products"> homepage section
  • storefront_homepage_after_featured_products_title – Executed after the <h2 class="section-title"> featured products section title
  • storefront_homepage_after_featured_products – Executed after the <section class="storefront-featured-products"> homepage section

Popular products

  • storefront_homepage_before_popular_products – Executed before the <section class="storefront-popular-products"> homepage section
  • storefront_homepage_after_popular_products_title – Executed after the <h2 class="section-title"> popular products section title
  • storefront_homepage_after_popular_products – Executed after the <section class="storefront-popular-products"> homepage section

On sale products

  • storefront_homepage_before_on_sale_products – Executed before the <section class="storefront-on-sale-products"> homepage section
  • storefront_homepage_after_on_sale_products_title – Executed after the <h2 class="section-title"> on-sale products section title
  • storefront_homepage_after_on_sale_products – Executed after the <section class="storefront-on-sale-products"> homepage section

Best-selling products

  • storefront_homepage_before_best_selling_products – Executed before the <section class="storefront-best-selling-products"> homepage section
  • storefront_homepage_after_best_selling_products_title – Executed after the <h2 class="section-title"> best-selling products section title
  • storefront_homepage_after_best_selling_products – Executed after the <section class="storefront-best-selling-products"> homepage section

Blog archive page

↑ Back to top
  • storefront_loop_before – Executed before all posts on blog archive
  • storefront_loop_post – Executed before each post on blog archive
  • storefront_post_content_before – Executed before the content of each post on blog archive
  • storefront_post_content_after – Executed after the content of each post on blog archive

General page

↑ Back to top
  • storefront_page_before – Executed after the `<main id=”main”>` tag on single pages
  • storefront_page – Executed after the opening `<div id=”post-…”>` tag on single pages
  • storefront_page_after – Executed at the end of the `<div id=”post-…”>` tag on single pages

Single post

↑ Back to top
  • storefront_single_post_before – Executed after the opening <main id="main"> tag on single blog posts
  • storefront_single_post_top – Executed after the opening <div id="post-..."> tag on single posts
  • storefront_single_post – Executed immediately after storefront_single_post_top hook to show post content
  • storefront_single_post_bottom – Executed before the closing <div id="post-..."> tag on single posts
  • storefront_single_post_after – Executed before the closing <main id="main"> tag on single blog posts

Sidebar

↑ Back to top
  • storefront_sidebar – Executed on all pages containing a sidebar, provided widgets are present

Footer

↑ Back to top
  • storefront_before_footer – Executed before <footer id="colophon"> tag
  • storefront_footer – Executed before closing <footer id="colophon"> tag
  • storefront_after_footer – Executed after closing <footer id="colophon"> tag

Filters reference guide

↑ Back to top
This document lists some of the most commonly used filters which are available within the Storefront theme. You can read more about add_filter() and what parameters can be used on the WordPress Developer Resources site here

Comments

↑ Back to top
File: comments.php
  • storefront_comment_form_args – filter the comment reply title HTML before and after

Storefront template functions

↑ Back to top
File: /inc/storefront-template-functions.php

Navigation menu

  • storefront_menu_toggle_text – filter the responsive menu toggle text

Homepage

Product categories
  • storefront_product_categories_args – filter the homepage product category arguments
  • storefront_product_categories_shortcode_args – filter the homepage product category shortcode arguments
Recent products
  • storefront_recent_products_args – filter the homepage recent products arguments
  • storefront_recent_products_shortcode_args – filter the homepage recent products shortcode arguments
Featured products
  • storefront_featured_products_args – filter the homepage featured products arguments.
  • storefront_featured_products_shortcode_args – filter the homepage featured products shortcode arguments.
Popular products
  • storefront_popular_products_args – filter the homepage popular products arguments.
  • storefront_popular_products_shortcode_args – filter the homepage popular products shortcode arguments.
On sale products
  • storefront_on_sale_products_args – filter the homepage on sale products arguments.
  • storefront_on_sale_products_shortcode_args – filter the homepage on sale products shortcode arguments
Best-selling products
  • storefront_best_selling_products_args – filter the homepage best selling products arguments
  • storefront_best_selling_products_shortcode_args – filter the homepage best selling products shortcode arguments

Single post

  • storefront_single_post_posted_on_html – filter the single posted on details

Footer

  • storefront_footer_widget_rows – filter number of footer widget rows (default: 1)
  • storefront_footer_widget_columns – filter number of footer widget columns (default: 4)
  • storefront_copyright_text – filter the footer copyright text
  • storefront_credit_link – filter the footer credit link

Storefront functions

↑ Back to top
File: /inc/storefront-functions.php
  • storefront_header_styles – filter the header styles
  • storefront_homepage_content_styles – filter the homepage content styles

Storefront classes

↑ Back to top
File: /inc/class-storefront.php
  • storefront_custom_background_args – filter the default background arguments
  • storefront_default_background_color – filter the default site background color
  • storefront_sidebar_args – filter the default sidebar arguments
  • storefront_google_font_families – filter default Google Font families
  • storefront_navigation_markup_template – filter the output markup of the navigation.

WooCommerce template functions

↑ Back to top
File: /woocommerce/storefront-woocommerce-template-functions.php
  • storefront_upsells_columns – filter the upsell columns (default: 3)
  • storefront_loop_columns – filter the default product loop display (default: 3)
  • storefront_handheld_footer_bar_links – filter handheld footer bar links

WooCommerce classes

↑ Back to top
File: /woocommerce/class-storefront-woocommerce.php
  • storefront_related_products_args – filter related products arguments
  • storefront_product_thumbnail_columns – filter product thumbnail columns (default: 4)
  • storefront_products_per_page – filter products per page on product categories.

Additional resources

↑ Back to top
For additional resources on Storefront development, please refer to the following: