Page Override
What is an override? It's a technique to create a clone-copy of a specific layout file that generates the graphical output of a specific page/content of the Plugin, or one of its Widgets. Imagine that you would like to remove a link from a page, or to add a text or a button. If you were to modify the original (core) file of the Plugin, then at its next update all your modifications would go lost. Instead, you can create an override for that specific layout file so that it will be preserved during the installation of the future updates.
Just to be clear, this is a feature of the plugin Vik Rent Items and all its widgets, because WordPress does not support overrides by default. It's a function that our programmers have built to meet the needs of our clients.
In order to create an override-file for a specific page of the Plugin, either front-end or back-end, or a new layout file for a Widget, you need an FTP client software to create a couple of folders, and to download and upload some PHP files.
This is a list of the required steps to create an override file:
- Locate your WordPress Upload Directory via FTP. The directory usually used as the upload dir is in /wp-content/uploads/.
- Make sure to have uploaded at least one photo for your items through the admin pages of Vik Rent Items.
- Locate the Vik Rent Items Upload Directory via FTP. It's always a sub-directory of the WordPress Upload Directory. Usually /wp-content/uploads/vikrentitems/.
- Locate the Vik Rent Items Overrides Directory via FTP, and keep this path in mind, as this is called the Overrides Base Path. Usually /wp-content/uploads/vikrentitems/overrides/.
- Create a folder inside the Overrides Base Path called "site" that will store all the override files for the pages of the front-end site. Depending on your Upload Directory, the path should be similar to /wp-content/uploads/vikrentitems/overrides/site/.
- Find the name of the page (View) of the front-end in Vik Rent Items that you would like to customize. For example, the list of cars is generated through the View (layout file) called "itemslist".
- Copy the original layout file of the View (default.php) onto the Overrides Base Path directory "site". For creating a copy of the layout file of the View called "itemslist", you should copy the following file:
/wp-content/plugins/vikrentitems/site/views/itemslist/tmpl/default.php
onto the following directory, given the examples above with our Overrides Base Path:
/wp-content/uploads/vikrentitems/overrides/site/tiemslist/default.php
The view "itemslist" was missing in "/site" so this had to be created via FTP. Now the path above will be used by the Vik Rent Items plugin to load the layout file for the page Items List. - Modify the HTML/PHP/JS/CSS code of the layout file to meet your needs. This override file will never be touched by future updates, and it's a secure layout file because it can only be executed by Vik Rent Items behind the execution of the WordPress framework.
Imagine that you would like to create an override file for a specific Widget, like the Search Form or the Currency Converter: you can create an override layout file also for the Widgets! In this case, next to the folder "site" in the Overrides Base Path directory, create a folder via FTP called "modules", that contains the name of the Widget and its layout file inside it. Then, by editing the parameters of the Widget from the wp-admin section, you will be able to choose the desired layout file from the overrides.
For example, to create an override file of the Widget "Search Form", you should copy the following file:
/wp-content/plugins/vikrentitems/modules/mod_vikrentitems_search/tmpl/default.php
onto the following path, by creating the missing directories after your Overrides Base Path of Vik Rent Car:
/wp-content/uploads/vikrentitems/overrides/modules/mod_vikrentitems_search/default.php