Reputation: 33
So I am using a theme from themeforest for a car listing dealership. I am trying to hide the price or display another thing such as a call for price button.
Is there a way to do this with javascript or css?
Here is the current sniplet of code:
<div class="price">
<span <?php if ($show_currency_converter) { ?>class="convert"<?php } ?> data-convert="<?php tmm_get_car_price($post_id, 1); ?>">
<?php tmm_get_car_price($post_id, 1); ?>
</span>
</div>
Basically when the price variable is $0 , I like to not display at all. Or if I have to display something. I like for it to say "call For Price"
Upvotes: 0
Views: 266
Reputation:
If tmm_get_car_price($post_id, 1)
returns 0
use this CSS.
span[data-convert="0"] {
display:none;
}
If it returns $0
use this CSS.
span[data-convert="$0"] {
display:none;
}
Upvotes: 1
Reputation: 21759
If your tmm_get_car_price
is the function that will get the price, you could do as follows with javascript/jquery:
$('span[data-convert="0"]').hide();
Upvotes: 2