Skip to content
Docs
Get RestroPress

Action

rpress_fooditem_section_after_addons

Updated
On this page

Fires in the menu item editor after the Add-ons section, which is the last built-in section.

Runs while the menu item editor panel is rendered, after the Add-ons section. 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#

ParameterTypeDescription
$postWP_PostThe 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_addons', '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 136), in RP_FoodItem_Meta_Boxes::output_tabs()

See also#

Was this page helpful?