Filter
rpress_item_price_display
On this page
Filters the price shown on a menu item card.
Runs in the menu item card templates for the fooditem and grid layouts when the price is printed. For variable-priced items the value is the price range markup, for others the formatted price.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$price_html | string | The price output: a formatted price, or the price range markup for variable-priced items. |
$post | WP_Post | The menu item post. |
Return value#
string. The price output.
Example#
function my_item_price_display( $price_html, $post ) {
if ( ! rpress_has_variable_prices( $post->ID ) ) {
$price_html = sprintf( __( 'From %s', 'my-textdomain' ), $price_html );
}
return $price_html;
}
add_filter( 'rpress_item_price_display', 'my_item_price_display', 10, 2 );
Notes#
For variable-priced items the output allows only span, del and ins tags. For single-priced items it is printed through esc_html(), so markup is not rendered. The list layout and the modern template pack do not apply this filter.
Source#
Applied in:
templates/fooditem/content-cart-button.php(line 48)templates/fooditem/content-cart-button.php(line 60)templates/grid/content-cart-button.php(line 46)templates/grid/content-cart-button.php(line 58)
Was this page helpful?
