Content visibility condition based on date

by heroj   Last Updated October 19, 2019 08:08 AM - source

How can I use visibility condition for displaying post no older than 30 days as described here: https://docs.dynamic.ooo/article/58-visibility-triggers-custom-condition I try something like this

$today = date('r');
$articledate = get_the_time('r');
$difference = round((strtotime($today) - strtotime($articledate))/(24*60*60),0);
if ($difference <= 30) {return true;
 }

or this:

$value = get_post_meta (get_the_date( 'l F j, Y' )) ;
if ($value < 30){
Return true;
}

but not work.



Related Questions



How do test if a post is a custom post type?

Updated June 10, 2019 12:08 PM

BuddyPress User Profile Menu

Updated February 26, 2017 15:08 PM