English (United Kingdom)
1.0.8

Need to customize the layout of a specific page of the Plugin? Thanks to the Overrides function, you will be able to create a copy of the layout file of a specific page to customize it. This will prevent future updates to overwrite your modifications.

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 Booking 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. Since the 1.6.5 version of VikBooking you'll be able to create and manage all your overrides directly from the configuration page of the plugin. We'll see later how this tool works. The basics come first.

This is a list of the required steps to create an override file:

  1. Locate your WordPress Upload Directory via FTP. The directory usually used as the upload dir is in /wp-content/uploads/.
  2. Make sure to have uploaded at least one photo for your rooms through the admin pages of Vik Booking.
  3. Locate the Vik Booking Upload Directory via FTP. It's always a sub-directory of the WordPress Upload Directory. Usually /wp-content/uploads/vikbooking/.
  4. Locate the Vik Booking Overrides Directory via FTP, and keep this path in mind, as this is called the Overrides Base Path. Usually /wp-content/uploads/vikbooking/overrides/.
  5. 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/vikbooking/overrides/site/.
  6. Find the name of the page (View) of the front-end in Vik Booking that you would like to customize. For example, the list of rooms is generated through the View (layout file) called "roomslist".
  7. 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 "roomslist", you should copy the following file:
    /wp-content/plugins/vikbooking/site/views/roomslist/tmpl/default.php

    onto the following directory, given the examples above with our Overrides Base Path:
    /wp-content/uploads/vikbooking/overrides/site/roomslist/default.php

    The view "roomslist" was missing in "/site" so this had to be created via FTP. Now the path above will be used by the Vik Booking plugin to load the layout file for the page Rooms List.

  8. 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 Booking behind the execution of the WordPress framework.

Imagine that you would like to create an override file for a specific Widget, like the Horizontal 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 "Vik Booking Search Form", you should copy the following file:
/wp-content/plugins/vikbooking/modules/mod_vikbooking_horizontalsearch/tmpl/default.php

onto the following path, by creating the missing directories after your Overrides Base Path of Vik Booking:
/wp-content/uploads/vikbooking/overrides/modules/mod_vikbooking_horizontalsearch/default.php

Are you using VikBooking 1.6.5 or newer?

Marvelous! Your plugin supports a tool that lets you create and manage the overrides directly from the back-end of VikBooking.

Last Update: 2023-10-25
Helpful?
71% of people found this helpful.