Common changes with a few lines of code (Recipes)
Also called: code snippets, functions.php recipes, child theme examples, marketplace code, WCFM add-on hooks examples
Each recipe below makes one change that site owners often ask for. Copy the snippet, paste it into your child theme, and save. Every snippet was tested with Reign WCFM Addon 2.0.0, WCFM Marketplace, Reign 8.1.0 and the official Reign child theme.
Before you start
Section titled “Before you start”- Install and activate the Reign child theme. Changes in the parent theme are lost when Reign updates.
- Open the child theme’s
functions.php. Paste each snippet at the very end of the file. - Edit files through your host’s file manager or SFTP. If a snippet has a typo, the site can show an error. You can then fix the file the same way.
Try each change on a staging copy first if your site is busy.
The add-on has no template files to copy. Every change below is a filter.
Rename the Store tab on vendor profiles
Section titled “Rename the Store tab on vendor profiles”Vendor profiles get a Store tab with the vendor’s products. This snippet calls it “Shop” instead.
add_filter( 'reign_wcfm_store_tab_name', function () { return 'Shop';} );Use reign_wcfm_favourite_tab_name the same way to rename the Favourite products tab. Members see that tab only on their own profile.
You’ll know it worked when a vendor’s profile shows a tab called “Shop”.
Show more products on the profile tabs
Section titled “Show more products on the profile tabs”The Store and Favourite products tabs show 12 products per page. This snippet shows 24.
add_filter( 'reign_wcfm_profile_products_per_page', function () { return 24;} );The add-on keeps the number between 1 and 48, so a bigger value shows 48.
You’ll know it worked when a vendor with more than 12 products shows up to 24 on the first page of the Store tab.
Change how reviews read in the activity feed
Section titled “Change how reviews read in the activity feed”When a member reviews a product, the feed says “Amina Diallo wrote a review of Beanie”. This snippet makes it say “Amina Diallo rated Beanie”.
add_filter( 'reign_wcfm_activity_action_review', function ( $action, $activity ) { return sprintf( '%1$s rated %2$s', bp_core_get_userlink( $activity->user_id ), '<a href="' . esc_url( get_permalink( $activity->item_id ) ) . '">' . esc_html( get_the_title( $activity->item_id ) ) . '</a>' );}, 10, 2 );In the activity object, user_id is the reviewer and item_id is the product. The line is built each time the entry shows, so older review posts change too.
You’ll know it worked when review posts in the activity feed read “rated” instead of “wrote a review of”.
Good to know
Section titled “Good to know”My snippet broke the site. What do I do?
Section titled “My snippet broke the site. What do I do?”Open functions.php again through your host’s file manager or SFTP. Remove the snippet you just added and save. The site comes back straight away.
Can I use a code snippets plugin instead?
Section titled “Can I use a code snippets plugin instead?”Yes. These snippets work the same in a snippets plugin.
Where do I find more hooks?
Section titled “Where do I find more hooks?”Every hook the add-on offers is in Hooks and filters.

