Five Star Restaurant Menu and Food Ordering Shortcodes

Below, you’ll find a detailed guide on how to add the Five Star Restaurant Menu and Food Ordering Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Five Star Restaurant Menu and Food Ordering Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Five Star Restaurant Menu and Food Ordering Plugin and the shortcodes it provides:

Plugin Icon
Five Star Restaurant Menu and Food Ordering

Five Star Restaurant Menu and Food Ordering is a versatile WordPress plugin. It simplifies the process of creating and managing your restaurant's menu online, and facilitates food ordering for your customers.

★★★★☆ (99) Active Installs: 8000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [fdm-menu]
  • [fdm-menu-section]
  • [fdm-menu-item]

Five Star Restaurant Menu and Food Ordering [fdm-menu] Shortcode

The Food and Drink Menu (fdm) shortcode is a dynamic tool for creating and customizing food menus on your website. This shortcode allows you to set specific attributes such as ‘id’, ‘layout’, ‘show_title’, and ‘show_content’. It also facilitates potential order status updates and displays a success message upon order completion.

Shortcode: [fdm-menu]

Parameters

Here is a list of all possible fdm-menu shortcode parameters and attributes:

  • id – Represents the unique identifier of the menu
  • layout – Defines the design of the menu, default is ‘classic’
  • show_title – Controls whether the menu title is displayed or not
  • show_content – Decides if the menu content should be shown or hidden

Examples and Usage

Basic example – Show a menu with the ID of 1, using the classic layout

[fdm-menu id=1 layout=classic]

Advanced examples

Display a menu with the ID of 2, using the modern layout, without showing the title or content

[fdm-menu id=2 layout=modern show_title=false show_content=false]

Display a menu with the ID of 3, using the classic layout, showing the title but not the content

[fdm-menu id=3 layout=classic show_title=true show_content=false]

Display a menu with the ID of 4, using the modern layout, showing both the title and content

[fdm-menu id=4 layout=modern show_title=true show_content=true]

These examples illustrate how you can use the ‘fdm-menu’ shortcode to display menus in different ways on your WordPress site. By changing the attributes, you can control the layout of the menu, whether the title and content are displayed, and which menu is shown.

PHP Function Code

In case you have difficulties debugging what causing issues with [fdm-menu] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'fdm-menu', 'fdm_menu_shortcode' );

Shortcode PHP function:

function fdm_menu_shortcode( $atts ) {
	global $fdm_controller;

	// Define shortcode attributes
	$menu_atts = array(
		'id' => null,
		'layout' => 'classic',
		'show_title' => false,
		'show_content' => false,
	);

	// Create filter so addons can modify the accepted attributes
	$menu_atts = apply_filters( 'fdm_shortcode_menu_atts', $menu_atts );

	// Extract the shortcode attributes
	$args = shortcode_atts( $menu_atts, $atts, 'fdm-menu' );

	do_action( 'fdm_menu_init', $args );

	if ( ! empty( $_GET['order_success'] ) ) {

		echo '<div class="fdm-order-payment-message fdm-order-payment-successful">' . esc_html( $fdm_controller->settings->get_setting( 'label-order-success' ) ) . '</div>';
	}

	fdm_possible_order_status_update();

	// Render menu
	fdm_load_view_files();
	$menu = new fdmViewMenu( $args );

	return $menu->render();
}

Code file location:

food-and-drink-menu/food-and-drink-menu/includes/template-functions.php

Five Star Restaurant Menu and Food Ordering [fdm-menu-section] Shortcode

The Food and Drink Menu (FDM) shortcode is a powerful tool for managing your restaurant’s online menu. This shortcode allows you to display specific sections of your menu by specifying the ‘id’. It also provides the flexibility to either integrate the section within your existing menu layout or showcase it as a stand-alone feature. This is controlled via the ‘stand_alone’ attribute. The shortcode applies a filter, allowing addons to modify accepted attributes, ensuring maximum customization. It then extracts these attributes and renders the menu section accordingly. This makes the [fdm-menu-section] shortcode a versatile and essential tool for any restaurant website.

Shortcode: [fdm-menu-section]

Parameters

Here is a list of all possible fdm-menu-section shortcode parameters and attributes:

  • id – Identifies a specific section of the menu
  • stand_alone – If true, display the section independently

Examples and Usage

Basic example – Display a specific menu section by referencing its ID

[fdm-menu-section id=1 /]

Advanced examples

Display a specific menu section by referencing its ID, but without allowing it to stand alone. This means the menu section will not display if it’s not part of a larger menu.

[fdm-menu-section id=1 stand_alone=false /]

Display a specific menu section by referencing its ID, and allowing it to stand alone. This means the menu section will display even if it’s not part of a larger menu.

[fdm-menu-section id=1 stand_alone=true /]

Note that the ‘stand_alone’ attribute is optional, and defaults to ‘true’ if not specified. This means that if you don’t include the ‘stand_alone’ attribute in your shortcode, the menu section will be displayed even if it’s not part of a larger menu.

PHP Function Code

In case you have difficulties debugging what causing issues with [fdm-menu-section] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'fdm-menu-section', 'fdm_menu_section_shortcode' );

Shortcode PHP function:

function fdm_menu_section_shortcode( $atts ) {

	// Define shortcode attributes
	$menu_section_atts = array(
		'id' => null,
		'stand_alone' => true,
	);

	// Create filter so addons can modify the accepted attributes
	$menu_section_atts = apply_filters( 'fdm_shortcode_menu_section_atts', $menu_section_atts );

	// Extract the shortcode attributes
	$args = shortcode_atts( $menu_section_atts, $atts, 'fdm-menu-section' );

	// Render menu
	fdm_load_view_files();
	$menu = new fdmViewSection( $args );

	return $menu->render();
}

Code file location:

food-and-drink-menu/food-and-drink-menu/includes/template-functions.php

Five Star Restaurant Menu and Food Ordering [fdm-menu-item] Shortcode

The Food and Drink Menu (FDM) shortcode allows you to display a specific menu item on your WordPress site. The ‘fdm_menu_item_shortcode’ function defines the shortcode attributes, applies any modifications via filters, extracts the shortcode attributes, and finally, renders the menu item. The ‘id’ attribute specifies the menu item, ‘layout’ sets the display style, and ‘singular’ indicates if the item is standalone.

Shortcode: [fdm-menu-item]

Parameters

Here is a list of all possible fdm-menu-item shortcode parameters and attributes:

  • id – It’s the unique identifier of the menu item.
  • layout – Defines the style of the menu item, ‘classic’ by default.
  • singular – If true, displays only one menu item, otherwise, multiple.

Examples and Usage

Basic example – Displays a menu item with the specified ID in the classic layout.

[fdm-menu-item id=1 /]

Advanced examples

Displays a menu item with the specified ID in a custom layout instead of the classic one.

[fdm-menu-item id=1 layout='custom' /]

Displays a menu item with the specified ID in the classic layout but in singular form.

[fdm-menu-item id=1 singular=true /]

Displays a menu item with the specified ID in a custom layout and in singular form.

[fdm-menu-item id=1 layout='custom' singular=true /]

PHP Function Code

In case you have difficulties debugging what causing issues with [fdm-menu-item] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'fdm-menu-item', 'fdm_menu_item_shortcode' );

Shortcode PHP function:

function fdm_menu_item_shortcode( $atts ) {

	// Define shortcode attributes
	$menu_item_atts = array(
		'id' => null,
		'layout' => 'classic',
		'singular' => true
	);

	// Create filter so addons can modify the accepted attributes
	$menu_item_atts = apply_filters( 'fdm_shortcode_menu_item_atts', $menu_item_atts );

	// Extract the shortcode attributes
	$args = shortcode_atts( $menu_item_atts, $atts, 'fdm-menu-item' );

	// Render menu
	fdm_load_view_files();
	$menuitem = new fdmViewItem( $args );

	return $menuitem->render();
}

Code file location:

food-and-drink-menu/food-and-drink-menu/includes/template-functions.php

Conclusion

Now that you’ve learned how to embed the Five Star Restaurant Menu and Food Ordering Plugin shortcodes, 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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *