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
{}
sign above the editor. This will add your code in a code block that will make your code more readable :-). To learn how the site operates, feel free to take a tour and visit How to Ask and help center to learn how to ask good questions