Filter
rpress_fooditem_columns
On this page
Filters the columns shown in the admin Menu Items list table.
The default columns are cb, title, food_category, fooditem_tag, price, earnings and date. Add or remove keys to change the table; render the cell for a new column with the manage_fooditem_posts_custom_column action.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fooditem_columns | array | Associative array of column keys to column header labels. |
Return value#
array. The columns array.
Example#
function my_fooditem_columns( $columns ) {
$columns['prep_time'] = esc_html__( 'Prep Time', 'my-plugin' );
return $columns;
}
add_filter( 'rpress_fooditem_columns', 'my_fooditem_columns' );
function my_fooditem_column_content( $column, $post_id ) {
if ( 'prep_time' === $column ) {
echo esc_html( get_post_meta( $post_id, 'my_prep_time', true ) );
}
}
add_action( 'manage_fooditem_posts_custom_column', 'my_fooditem_column_content', 10, 2 );
Source#
Applied in:
includes/admin/fooditems/dashboard-columns.php(line 35), inrpress_fooditem_columns()
See also#
Was this page helpful?
