2. ABOUT ME
• Full-Stack Web Developer & Interaction Designer
• CTO at OKIA (okia.ee)
• 15+ years of experience
• WordPress 5+ years
3. WHAT IS VIKING MOTORS?
• viking-motors.ee
• Estonian-owned car dealer
• Sells KIA , OPEL, Cadillac, Corvette brands and offers services for SAAB brand
• Located in Tallinn, Estonia
4. VIKING MOTORS NEW WEBSITE
• Why WordPress?
• Good platform for displaying data (has simple theme architecture)
• Has all the API-s to provide the functionality needed to create fast and great quality
website.
• Because we love WordPress
• What role has Auto24.ee?
• Data provider
• All cars and their metadata is stored in Auto24 (all the content management is done there)
• Every day at 6AM we delete all cars and data associated with and import data again.
• Because Auto24’s RESTful API response is very slow
• Viking-motors.ee was one of the first to use their new API
5. VIKING MOTORS NEW WEBSITE
• What is special about viking-motors.ee?
• How we query metadata about every car
• How we organize the data we have
• How we decide which single template to choose (car’s details)
• How we cache the results
6. VIKING MOTORS NEW WEBSITE
• Custom post type
• A lot of meta fields (we use CMB2 library)
• We have an importer script
• For every car type separate importer (in-stock, new, used).
• Every car is a Post that has metadata associated with (technical data, equipment
data etc)
• Custom rewrite rules
• soiduk/kasutatud/([^/]+)/?$ <= for used cars
• soiduk/uued-tellimisel/([^/]+)/?$ <= for new cars
• soiduk/uued-kohe-saadaval/([^/]+)/?$ <= for cars which are already in stock
7. VIKING MOTORS NEW WEBSITE
Function to check which type of car is currently queried
8. This is how we add and remove
meta keys.
If the client would like to have a
new metadata to be stored in
WordPress, we just need to add
this to the list and all the new
meta fields fill be displayed in
admin area automatically.
9. Viking Motors new website
This function is for querying metadata. As many in one
query as possible.
10. Here we collect and cache all search criteria that will be
used on front page search form.
11. We use “post_type_link” hook to override car’s permalink
so that it would meet our custom rewrite rules.
12. We use “template_include” hook to override WordPress's
default template behavior.
- single-oi_used_item.php
- single-oi_new_item.php (this template will be used for
stock cars as well)