1

I need to merge the following two functions, but I can't seem to get the syntax right:

One:

<?php= time() > strtotime( $var = get_post_meta($post->ID, 'hub_expiry-date', true) ) ? 'expired' : '' ?>

Two:

<?php
$var = get_post_meta($post->ID, 'hub_expiry-date', true); if ($var == '') { echo ""; } else { echo 'expired'; }
?>

What is the correct way of merging these?

Thanks Zach

1
  • Just a note on the terminology: those are not functions. Commented May 31, 2011 at 12:52

1 Answer 1

1
<?php
$var = get_post_meta($post->ID, 'hub_expiry-date', true);
if ( !empty($var) && time() > strtotime($var) ) {
    echo 'expired';
}
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.