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 topActions reference guide
↑ Back to topadd_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 topstorefront_before_site
– Executed after opening<body>
tagstorefront_before_content
– Executed before opening<div id="content">
tagstorefront_content_top
– Executed after opening<div id="content">
tag
Header
↑ Back to topstorefront_before_header
– Executed after<div id="page">
tagstorefront_header
– Executed inside<div class="col-full">
of the<header id="masthead">
tag
Homepage
↑ Back to topstorefront_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 sectionstorefront_homepage_after_product_categories_title`
– Executed after the<h2 class="section-title">
product categories section titlestorefront_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 sectionstorefront_homepage_after_recent_products_title
– Executed after the<h2 class="section-title">
recent products section titlestorefront_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 sectionstorefront_homepage_after_featured_products_title
– Executed after the<h2 class="section-title">
featured products section titlestorefront_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 sectionstorefront_homepage_after_popular_products_title
– Executed after the<h2 class="section-title">
popular products section titlestorefront_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 sectionstorefront_homepage_after_on_sale_products_title
– Executed after the<h2 class="section-title">
on-sale products section titlestorefront_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 sectionstorefront_homepage_after_best_selling_products_title
– Executed after the<h2 class="section-title">
best-selling products section titlestorefront_homepage_after_best_selling_products
– Executed after the<section class="storefront-best-selling-products">
homepage section
Blog archive page
↑ Back to topstorefront_loop_before
– Executed before all posts on blog archivestorefront_loop_post
– Executed before each post on blog archivestorefront_post_content_before
– Executed before the content of each post on blog archivestorefront_post_content_after
– Executed after the content of each post on blog archive
General page
↑ Back to topstorefront_page_before
– Executed after the `<main id=”main”>` tag on single pagesstorefront_page
– Executed after the opening `<div id=”post-…”>` tag on single pagesstorefront_page_after
– Executed at the end of the `<div id=”post-…”>` tag on single pages
Single post
↑ Back to topstorefront_single_post_before
– Executed after the opening<main id="main">
tag on single blog postsstorefront_single_post_top
– Executed after the opening<div id="post-...">
tag on single postsstorefront_single_post
– Executed immediately afterstorefront_single_post_top
hook to show post contentstorefront_single_post_bottom
– Executed before the closing<div id="post-...">
tag on single postsstorefront_single_post_after
– Executed before the closing<main id="main">
tag on single blog posts
Sidebar
↑ Back to topstorefront_sidebar
– Executed on all pages containing a sidebar, provided widgets are present
Footer
↑ Back to topstorefront_before_footer
– Executed before<footer id="colophon">
tagstorefront_footer
– Executed before closing<footer id="colophon">
tagstorefront_after_footer
– Executed after closing<footer id="colophon">
tag
Filters reference guide
↑ Back to topadd_filter()
and what parameters can be used on the WordPress Developer Resources site here
Comments
↑ Back to topcomments.php
storefront_comment_form_args
– filter the comment reply title HTML before and after
Storefront template functions
↑ Back to top/inc/storefront-template-functions.php
Navigation menu
storefront_menu_toggle_text
– filter the responsive menu toggle text
Homepage
Product categoriesstorefront_product_categories_args
– filter the homepage product category argumentsstorefront_product_categories_shortcode_args
– filter the homepage product category shortcode arguments
storefront_recent_products_args
– filter the homepage recent products argumentsstorefront_recent_products_shortcode_args
– filter the homepage recent products shortcode arguments
storefront_featured_products_args
– filter the homepage featured products arguments.storefront_featured_products_shortcode_args
– filter the homepage featured products shortcode arguments.
storefront_popular_products_args
– filter the homepage popular products arguments.storefront_popular_products_shortcode_args
– filter the homepage popular products shortcode arguments.
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
storefront_best_selling_products_args
– filter the homepage best selling products argumentsstorefront_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 textstorefront_credit_link
– filter the footer credit link
Storefront functions
↑ Back to top/inc/storefront-functions.php
storefront_header_styles
– filter the header stylesstorefront_homepage_content_styles
– filter the homepage content styles
Storefront classes
↑ Back to top/inc/class-storefront.php
storefront_custom_background_args
– filter the default background argumentsstorefront_default_background_color
– filter the default site background colorstorefront_sidebar_args
– filter the default sidebar argumentsstorefront_google_font_families
– filter default Google Font familiesstorefront_navigation_markup_template
– filter the output markup of the navigation.
WooCommerce template functions
↑ Back to top/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/woocommerce/class-storefront-woocommerce.php
storefront_related_products_args
– filter related products argumentsstorefront_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- WordPress.org Codex – An introduction to hooks, filters and functions in WordPress
- Storefront Github Repository – The official code repository for all code
- Hookr.io Plugin – A plugin for easily finding a reference guide for all hooks & filters