Below, you’ll find a detailed guide on how to add the Restaurant Menu and Food Ordering Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Restaurant Menu and Food Ordering Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Restaurant Menu and Food Ordering Plugin and the shortcodes it provides:
"Restaurant Menu and Food Ordering is a WordPress plugin designed to simplify restaurant operations. It allows you to create digital menus, manage orders efficiently, and streamline your food service. Ideal for eateries of all sizes."
- [mprm_categories]
Restaurant Menu and Food Ordering [mprm_categories] Shortcode
The MP-Restaurant-Menu plugin shortcode, ‘mprm_categories’, is used to render categories on your website. It fetches data from the ‘Shortcode_Category’ class and displays it using the ‘render_shortcode’ function. The ‘render_shortcode’ function takes in arguments and returns HTML content. It uses the ‘get_template_html’ method from the ‘View’ class to display the contents in the “shop/cart” template.
Shortcode: [mprm_categories]
Examples and Usage
Basic example – A straightforward usage of the shortcode to display the restaurant menu categories.
[mprm_categories /]
Advanced examples
Displaying restaurant menu categories with a specific layout. In this case, the shortcode is used with two parameters: ‘layout’ and ‘categ’. ‘layout’ is used to specify the layout of the menu categories and ‘categ’ is used to display categories by their IDs.
[mprm_categories layout="grid" categ="1,2,3" /]
Another advanced usage can be to display the restaurant menu categories with a specific number of columns. Here, the shortcode is used with the ‘columns’ parameter to specify the number of columns.
[mprm_categories columns="3" /]
It is also possible to combine multiple parameters to customize the display of the restaurant menu categories. In this example, the shortcode is used with ‘layout’, ‘categ’, and ‘columns’ parameters.
[mprm_categories layout="grid" categ="1,2,3" columns="3" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [mprm_categories]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('mprm_categories', array(Shortcode_Category::get_instance(), 'render_shortcode'));
Shortcode PHP function:
function render_shortcode($args) {
return View::get_instance()->get_template_html("shop/cart", $args);
}
Code file location:
mp-restaurant-menu/mp-restaurant-menu/classes/class-hooks.php
Conclusion
Now that you’ve learned how to embed the Restaurant Menu and Food Ordering Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply