Skip to content

More than 1 price on cards

Vehica listing cards show a single price by default. This article shows how to display a second price field — a monthly rate, for example — on the big card, by overriding the card template in your child theme and pasting in a short PHP snippet.

1 minute read

This PHP snippet displays a second price field on the big card on your website.

Vehica big listing card for "BMW 8-serie 2-door coupe grey" showing the main price $62,000 and, below it in orange, a second price line reading "Per month / $1,233"
Work in the child theme
Make the change in the child theme — that way you do not lose it when the theme is updated — and always back up your website before you start.

The code

php
</br> <span style="font-size: 12px ; color: orange; ">

                            <?php

$priceField = vehicaApp('price_fields')->find(function($priceField) {

   return $priceField->getId() === 18091;

});

if ($priceField instanceof \Vehica\Model\Post\Field\Price\PriceField) {

    echo $priceField->getFormattedValueByCurrency($vehicaCurrentCar);

}

?> </span>

Add the code to the big card

We show you how to change the big card on your page.

Open card_big_v1.php and copy it to your child theme. You will find this file in wp-content\themes\vehica\templates\card\car\card_big_v1.php.

Search for this line:

card_big_v1.php
<?php echo esc_html($vehicaPrice); ?>

Paste our code after it, and change the ID to the ID of your own price field.

Where to find the price field ID

Go to wp-admin > Vehica Panel > Custom Fields, choose your second price field and hit edit:

Vehica Panel > Custom Fields editing a price field named "Koszt 2", with Name "Price for rent", slug "rent" and Text before value "Per month /"; an arrow points up at the browser address bar
The ID is the number in the address bar — vehica_18091 here, the same number used in the snippet.

Change your ID and save the file.

That’s all for this card — if you want to modify other cards, do the same in the other card files.

Ask the people who build Vehica

We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.

Was this guide helpful?