因此,我将 themeforest 中的主题用于汽车上市经销商。我正在尝试隐藏价格或显示其他内容,例如询价按钮。
有没有办法用 javascript 或 css 做到这一点?
这是当前的代码片段:
<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>
基本上,当价格变量为 $0 时,我喜欢完全不显示。或者如果我必须展示一些东西。我喜欢它说“call For Price”
最佳答案
如果您的 tmm_get_car_price
是获取价格的函数,您可以使用 javascript/jquery 执行以下操作:
$('span[data-convert="0"]').hide();
关于javascript - 价格为零时隐藏价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31951509/