Action
rpress_fooditem_section_after_pricing
On this page
Fires in the menu item editor between the Pricing section and Category & Tags.
Runs while the menu item editor panel is rendered, after the Pricing section and before Category & Tags. Output a complete .rp-fi-section block and use RP_FoodItem_Meta_Boxes::next_section_number() for the section number so numbering stays consecutive.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$post | WP_Post | The menu item post being edited. |
Example#
function my_fooditem_extra_section( $post ) {
$value = get_post_meta( $post->ID, '_my_prep_notes', true );
?>
<div class="rp-fi-section">
<div class="rp-fi-section-header">
<span class="rp-fi-section-number"><?php echo esc_html( RP_FoodItem_Meta_Boxes::next_section_number() ); ?></span>
<?php esc_html_e( 'Prep notes', 'my-plugin' ); ?>
</div>
<div class="rp-fi-section-body">
<textarea name="my_prep_notes" rows="3" class="widefat"><?php echo esc_textarea( $value ); ?></textarea>
</div>
</div>
<?php
}
add_action( 'rpress_fooditem_section_after_pricing', 'my_fooditem_extra_section', 10, 1 );
Notes#
Printing a field does not save it. Save submitted values on rpress_save_fooditem, which receives the post ID and the post object.
Source#
Fired from:
includes/admin/fooditems/class-rp-fooditem-metaboxes.php(line 123), inRP_FoodItem_Meta_Boxes::output_tabs()
See also#
Was this page helpful?
