Subscribe to our YouTube channel and Contact us to grab a flat 20% discount on our products. Subscribe now

How Can We Help?

Template Overriding

Print
< All Topics

Overriding template files 

WP food Manager Plugin has a “templates” directory which contains all the template files that create the frontend view of your food item. “Form-fields” directory is also present in this “templates” folder which contains all the form control template files.

Template Files

Overriding template files through a theme

You can use your themes and override them with the template files to customize them.

  1. Create a new folder “wp-food-manager” inside your theme folder. e.g yourtheme/wp-food-manager.

For example, you want to override plugins/wp-food-manager/content-food_listing_type.php, then you can copy this file into yourtheme/wp-food-manager. Here we have shown an example with a Twenty Twenty Two theme.
Template Files Override

You should regularly update files if you have customized the template files or if there is any update in the plugins to maintain the compatibility. For example, if you have modified the template files in the core plugin, then make sure you maintain the same in themes/wp-food-manager/file

Also, customize only those template files where needed.

Overriding template file through a code

Any WordPress plugin developer can use the below filter to override the template files: “food_manager_locate_template”

Through this filter, you can change the template’s file path and name that you have overridden.

Table of Contents
Close