Filter
time_based_menu_rpress_foods
On this page
Filters the food category slugs rendered in the menu item list.
Runs in the menu list templates after the categories are loaded. The array holds the slugs of food-category terms in display order. Remove slugs to hide categories, for example outside serving hours. When the returned array is empty, a "no menu items found" message is shown.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$all_terms | string[] | Slugs of the food categories to display. |
Return value#
array. The category slugs to display.
Example#
function my_time_based_menu( $all_terms ) {
if ( (int) current_time( 'G' ) >= 11 ) {
$all_terms = array_values( array_diff( $all_terms, array( 'breakfast' ) ) );
}
return $all_terms;
}
add_filter( 'time_based_menu_rpress_foods', 'my_time_based_menu' );
Notes#
The hook name has no rpress_ prefix.
Source#
Applied in:
templates/fooditem/fooditems.php(line 67)templates/fooditem/fooditems.php(line 113)templates/grid/fooditems.php(line 97)templates/list/fooditems.php(line 94)
See also#
Was this page helpful?
