Evaluate for recurring Date

This creates a ShortCode to use when Date CF (Timestamps) need to be evaluated by recurring dates, just as for Birthdays.

Create a CPT, associate a Date CF to it, list CPT in a View and see in the code how to evaluate.
Remember to Register the ShortCode in Views Settings.

function born_today_func( $atts ) {
    extract(shortcode_atts(array(
        'birthday' => get_post_meta(get_the_ID(), 'wpcf-your_slug', true),
 
    ), $atts)
           );
 
    if(((date('d', $birthday)) == date('d')) && (date('m', $birthday)) == date('m')){
        return 1;
    }else{
        return 0;
    }
}
add_shortcode( 'born-today', 'born_today_func' );

Evaluate like this in your view loop:



Let us know if this snippet is not working for you:

This snippet doesn’t work
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments