Skip to content

Template Override

The addon ships one template that can replace a WCFM Marketplace template: the Layout 2 single-store page.

  • File: templates/reign-wcfm-store-layout2.php
  • Replaces: WCFM Marketplace’s store/wcfmmp-view-store.php
  • When: only when the Single Store Layout setting is Layout 2.

The swap happens on WCFM’s wcfm_locate_template filter. When the requested template is store/wcfmmp-view-store.php and Layout 2 is selected, the addon returns the path to its own template instead.

The Layout 2 template is a full re-authoring of the WCFM store page, not a partial. It keeps calling the same WCFM template hooks that WCFM’s original store template fires, including:

  • Store lifecycle: wcfmmp_before_store, wcfmmp_after_store, wcfmmp_before_store_tabs, wcfmmp_after_store_tabs.
  • Banner: wcfmmp_store_before_bannar, wcfmmp_store_after_bannar, wcfmmp_store_before_bannar_image, wcfmmp_store_after_bannar_image, wcfmmp_store_before_bannar_text, wcfmmp_store_after_bannar_text.
  • Header: wcfmmp_store_before_header, wcfmmp_store_after_header, wcfmmp_store_before_avatar, wcfmmp_store_after_avatar, wcfmmp_store_before_address, wcfmmp_store_after_address, wcfmmp_store_before_phone, wcfmmp_store_after_phone, wcfmmp_store_before_email, wcfmmp_store_after_email, wcfmmp_store_before_follow_me, wcfmmp_store_after_follow_me, wcfmmp_store_before_enquiry, wcfmmp_store_after_enquiry, wcfmmp_store_mobile_badges.
  • Preference gates such as wcfm_is_allow_store_banner, wcfm_is_pref_vendor_reviews, wcfm_is_pref_vendor_followers, wcfm_is_pref_enquiry, and the various wcfmmp_is_allow_* filters.

Keeping these in place is what allows WCFM add-ons (enquiry, follow, badges, social) to keep working on Layout 2. If you fork the template, keep those hook calls, or that add-on UI will silently disappear.

The template resolves the active store sub-tab (Products, About, Policies, Reviews, Followers, Followings, Articles) from WCFM’s store endpoint query vars, defaulting to Products, and then loads WCFM’s own sub-templates for each. It does not re-implement those sub-templates.

The template header notes the standard WCFM override path: copy it to yourtheme/wcfm/store/. Because the addon injects its template through wcfm_locate_template, a site can also intercept the same filter at a later priority to substitute its own file.