Really not sure what's going on here, but this just isn't working! Anyone have any ideas on this?
I've tried this:
if(article_custom_field('product-type') !== '') {
if(article_custom_field('product-type') == 'cd') return $productType = 'cd';
if(article_custom_field('product-type') == 'audio') return $productType = 'headphones';
if(article_custom_field('product-type') == 'video') return $productType = 'facetime-video';
if(article_custom_field('product-type') == 'download') return $productType = 'save';
if(article_custom_field('product-type') == 'book') return $productType = 'book';
} else {
$productType = 'eye-open';
}
And this:
if(article_custom_field('product-type') === 'cd') {
$productType = 'cd';
} elseif(article_custom_field('product-type') === 'video') {
$productType = 'facetime-video';
} elseif(article_custom_field('product-type') === 'audio') {
$productType = 'headphones';
} elseif(article_custom_field('product-type') === 'download') {
$productType = 'save';
} elseif(article_custom_field('product-type') === 'book') {
$productType = 'book';
} else {
$productType = 'eye-open';
}
The aim to to change this:
<span class="product-type">
<img src="<?php echo theme_url('/assets/glyphicon-' . $productType . '.png'); ?>" width="25" alt="Product Type" class="img-responsive">
<?php echo article_custom_field('product-type'); ?>
</span>
Any ideas as to what I am doing wrong and why this code just isn't working for me? Whatever I set the 'article_custom_field('product-type') to, I still get 'eye-open'. What's the deal?
Aucun commentaire:
Enregistrer un commentaire