Skip to content

Filter and action hooks

Alberto de Vera Sevilla edited this page Nov 29, 2018 · 12 revisions

Filters:

/**
 *  This filter is used to allow extra
 *  html tags in brand descriptions
 */
add_filter( 'pwb_description_allowed_tags', function( $tags ){
  return $tags . '<iframe>';
} );

/**
 *  Allow you to modify the brands in the "filter by brand" widget
 */
add_filter( 'pwb_widget_brand_filter', function( $brands ){
  foreach( $brands as $key => $brand ) $brands[$key]->name = 'Prefix ' . $brand->name;
  return $brands;
} );

Actions

/**
 *  This hook is fired immediately before the
 *  product brands are printed in the product page
 */
add_action( 'pwb_before_single_product_brands', function( $brands ){
  echo '<h1>Brand title here:</h1>';
} );

/**
 *  This hook is fired immediately after the
 *  product brands are printed in the product page
 */
add_action( 'pwb_after_single_product_brands', function( $brands ){
  echo '<p>Some brand info here</p>';
} );
Clone this wiki locally