Below, you’ll find a detailed guide on how to add the RestroPress – Online Food Ordering System 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 RestroPress – Online Food Ordering System Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the RestroPress – Online Food Ordering System Plugin and the shortcodes it provides:
"RestroPress – Online Food Ordering System is a useful plugin transforming your WordPress website into a full-featured online food ordering platform, ideal for restaurants and food delivery services."
- [foodsearch]
- [rpress_cart]
RestroPress – Online Food Ordering System [foodsearch] Shortcode
The RestroPress ‘foodsearch’ shortcode is a powerful tool that enables a search functionality. This shortcode triggers the ‘rpress_foodsearch_callback’ function. The function initiates a buffer, executes the ‘rpress_search_form’ function, captures the output into a variable, and then clears the buffer. The result is a search form specifically for food items, enhancing user navigation and experience.
Shortcode: [foodsearch]
Examples and Usage
Basic example – Utilizes the ‘foodsearch’ shortcode to display the RestroPress search form on a page or post.
[foodsearch /]
Advanced examples
While the ‘foodsearch’ shortcode doesn’t take any parameters directly, you can influence its output by modifying the RestroPress search form. For instance, if you want to change the placeholder text of the search form, you can use the ‘rpress_product_search_placeholder’ filter.
function change_rpress_search_placeholder( $placeholder ) {
$placeholder = 'Search for your favorite meal...';
return $placeholder;
}
add_filter( 'rpress_product_search_placeholder', 'change_rpress_search_placeholder' );
After adding the above code to your theme’s functions.php file, the search form generated by the [foodsearch /] shortcode will now have a custom placeholder text.
PHP Function Code
In case you have difficulties debugging what causing issues with [foodsearch]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'foodsearch', 'rpress_foodsearch_callback' );
Shortcode PHP function:
function rpress_foodsearch_callback() {
ob_start();
rpress_search_form();
$data = ob_get_contents();
ob_get_clean();
return $data;
}
Code file location:
restropress/restropress/includes/rp-core-functions.php
RestroPress – Online Food Ordering System [rpress_cart] Shortcode
The RestroPress plugin shortcode ‘rpress_cart’ is used to display the shopping cart on any page. This shortcode calls the ‘rpress_get_cart’ function, which handles the retrieval and display of items in the user’s cart. The output is then stored and returned, allowing the cart to be displayed wherever this shortcode is used.
Shortcode: [rpress_cart]
Examples and Usage
Basic example – A simple usage of the shortcode to display the RestroPress cart on your page.
[rpress_cart /]
Advanced examples
Display the RestroPress cart with additional attributes. The attributes can be used to customize the appearance and functionality of the cart.
[rpress_cart show_quantity="true" show_subtotal="true" /]
In this example, the ‘show_quantity’ attribute is set to ‘true’ to display the quantity of items in the cart, and the ‘show_subtotal’ attribute is set to ‘true’ to display the subtotal of the items in the cart.
Another example would be to use the ‘hide_checkout_button’ attribute to hide the checkout button from the cart.
[rpress_cart hide_checkout_button="true" /]
By setting ‘hide_checkout_button’ to ‘true’, the checkout button will not be displayed in the cart.
PHP Function Code
In case you have difficulties debugging what causing issues with [rpress_cart]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'rpress_cart', 'rpress_rpress_cart_callback' );
Shortcode PHP function:
function rpress_rpress_cart_callback() {
ob_start();
do_action( 'rpress_get_cart' );
$data = ob_get_contents();
ob_get_clean();
return $data;
}
Code file location:
restropress/restropress/includes/rp-core-functions.php
Conclusion
Now that you’ve learned how to embed the RestroPress – Online Food Ordering System 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.
Leave a Reply