0

Can anyone help me to make code for this statement

<?php if(get_post_meta($post->ID, "price", $single = true) != ""){ ?>
<?php echo get_post_meta($post->ID, "price",$single = true); ?>
<?php } ?>

If in my custom field empty i want the statement continue with this code

<?php $asin = get_post_meta($post->ID, 'asin', true);
echo azon_us_price($asin);
 ?>
2
  • hi Null, in post meta with price id, if in the price id is empty i want statement continue with second statement and display result from there Feb 9, 2013 at 14:30
  • what is price id $post->ID ? Feb 9, 2013 at 14:30

1 Answer 1

0

I think you want to do this:

<?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);
}
?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.