Support

Account

Home Forums General Issues Display Current Month and Beyond?

Solving

Display Current Month and Beyond?

  • Hello, I wanted to display posts for the current month and beyond. Meaning, I would like to display dates for all of April and every date I have for the future. When April is done, the blog posts would be removed. Here is the current code I have to display for the current day:

    add_filter(‘kadence_blocks_pro_posts_grid_query_args’, ‘post_grid_sort_acf_date’, 20, 2);
    function post_grid_sort_acf_date($args, $attributes) {
    if (strpos($attributes[‘className’], ‘acf-sort’) !== false) {
    $args[‘meta_key’] = ‘release_dates’;
    $args[‘orderby’] = ‘meta_value_num’;
    $args[‘order’] = ‘ASC’;

    // Get the current date in the format that matches your ‘release_dates’ meta key values
    $current_date = current_time(‘Ymd’);

    // Add a meta query to filter posts with ‘release_dates’ in the future
    $args[‘meta_query’] = array(
    array(
    ‘key’ => ‘release_dates’,
    ‘value’ => $current_date,
    ‘compare’ => ‘>’,
    ‘type’ => ‘NUMERIC’
    )
    );
    }
    return $args;

    Sorry if this is in the wrong section. Thanks in advance.

  • Hmmm, is there someone I can reach out to via support?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.