任何人都可以帮助我为此声明制作代码
<?php if(get_post_meta($post->ID, "price", $single = true) != ""){ ?>
<?php echo get_post_meta($post->ID, "price",$single = true); ?>
<?php } ?>
如果在我的自定义字段中为空,我希望语句继续使用此代码
<?php $asin = get_post_meta($post->ID, 'asin', true);
echo azon_us_price($asin);
?>
答案 0 :(得分:0)
我想你想这样做:
<?php
if(!empty(get_post_meta($post->ID, "price", $single = true))){
echo get_post_meta($post->ID, "price",$single = true);
} else {
$asin = get_post_meta($post->ID, 'asin', true);
echo azon_us_price($asin);
}
?>