I'm a beginner in PHP and Wordpress and I would appreciate help on project I'm working on.
Currently I am using the below code to query a specific post and then echo it's expiration date (expiration date is set through a plugin) in a wordpress site:
<?php $postid = 3823; $date_format = __( 'd / m / Y' ); $expiration_date = get_post_meta( $postid, '_expiration_date', true); echo date_i18n( $date_format, strtotime( $expiration_date ) ); ?>
This is working fine. What I would like it to do is:
- I will have 2 posts, 1 published and one scheduled
- Query both posts, check which is publiched and echo it's expiration date