• Resolved egornmore

    (@egornmore)


    Hello,

    How I can create a custom PHP query for cars? Can I loop through the car list where each car is an object?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter egornmore

    (@egornmore)

    Update:
    Find out that I can find the cars array in helper.php or mod_vikrentcar_cars.php if there is a way to access that array from functions.php?

    • This reply was modified 2 years, 5 months ago by egornmore.
    • This reply was modified 2 years, 5 months ago by egornmore.
    Plugin Author e4jvikwp

    (@e4jvikwp)

    Hi,

    Thanks for your messages. Vik Rent Car is written according to the MVC pattern of PHP, and so accessing arrays or objects through the file functions.php will not work.

    You can find some technical documentation on our official website where we explain how to create an override of the default template/layout file of a Widget or a View (a page/shortcode). By cloning the existing and default template file, you can have your own template file inside the so called “overrides directory” and choose that layout from the parameters of the widget. The documentation is available in the Knowledge Base section of our website, inside the category “Customization Tips” and then “Page Overrides”.

    Alternatively, there are several native and custom hooks you could use, but if you want to manipulate a query or an array, then the best solution is definitely the overrides of the View template files. This way future updates will not touch your changes.

    Lastly, before editing the source code, you should make sure a parameter doesn’t exist already to perform the manipulation operation you need. Instead, if you need to statically add properties to each “car-object”, then again the overrides are the best solution.

    We hope this helps!

    The VikWP Team

    Thread Starter egornmore

    (@egornmore)

    Hi,
    Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post Types’ is closed to new replies.