$value ) { echo '  ' . esc_html( ucfirst($value) ) . ' '; } ?>
'any', // for fetching from all post types set (any) 'post_status' => 'publish', 'relation' => 'AND', // Optional, OR defaults to "AND" 'order' => 'ASC', 'posts_per_page' => $per_page, // -1 'paged' => $page, 'meta_key' => '_ataswp_scheduler_start_date', 'orderby' => 'meta_value', //or 'meta_value_num' convert timestamp 'meta_query' => array( array('key' => '_ataswp_scheduler', // where key = value 'value' => '1', 'compare' => '=' ), array('key' => '_ataswp_scheduler_intervals', // where key = value 'value' => $maintab, 'compare' => 'LIKE' ) )); $get_results = new WP_Query( $meta_query_args ); $posts_count = $get_results->found_posts; // get count if ( $get_results ) { ?>
posts as $post ) { // auto publish activated on the following posts, pages etc. $post_id = $post->ID; // get meta values by post_id $ataswp_scheduler = get_post_meta($post_id,'_ataswp_scheduler', true); $ataswp_scheduler_counter = get_post_meta($post_id,'_ataswp_scheduler_counter', true); if ( empty($ataswp_scheduler_counter) ) { $ataswp_scheduler_counter = '0'; } // only published if ( $ataswp_scheduler == '1' && get_post_status ( $post_id ) == 'publish' ) { $scheduler_intervals = get_post_meta($post_id,'_ataswp_scheduler_intervals', true); // json obj $scheduler_intervals_arr = json_decode($scheduler_intervals, true); // convert to array $cron_intervals = ATASWP_Helper::wp_cron_intervals(); $scheduler_times = get_post_meta($post_id,'_ataswp_scheduler_times', true); // json obj $scheduler_times_arr = json_decode($scheduler_times, true); // convert to array // start date $start_date = get_post_meta($post_id,'_ataswp_scheduler_start_date', true); $start_date_format = ATASWP_Helper::formatDate( $start_date ); // end date $end_date = get_post_meta($post_id,'_ataswp_scheduler_end_date', true); if ( !empty($end_date) && $end_date != '0000-00-00') { $end_date_format = ATASWP_Helper::formatDate( $end_date ); } else { $end_date_format = __( 'never', 'ataswp_lang' ); } // next scheduled $interval = $maintab; $next_scheduled_date = ATASWP_Scheduler::next_scheduled_date( $interval ); // trick, if start date is greater then recalculate the next scheduled date // start date + next interval if ($next_scheduled_date < $start_date) { $next_scheduled_date = date('Y-m-d', strtotime('next ' . $interval, strtotime($start_date))); // create next date } $next_scheduled_date_format = date('d F Y',strtotime($next_scheduled_date)); $scheduler_start_time = end($scheduler_times_arr); // get last array value $next_day = '
' . $interval; $next_time = ' start at
' . date('H:i A',strtotime($scheduler_start_time)) . '
'; // check: active, inactive, expired $scheduler_status_label = __( 'active', 'ataswp_lang' ); $scheduler_status = 'active'; // 0000-00-00 is for unlimited if ( $end_date != '0000-00-00' ) { if ( $end_date < $date ) { $scheduler_status_label = __( 'inactive', 'ataswp_lang' ); $scheduler_status = 'inactive'; } } /* echo '
';
			print_r( $data );
			echo '
'; */ ?>
' . esc_attr( get_the_title($post_id) ) . ''; echo $view; ?>
max_num_pages; $total = $posts_count; echo '
'; echo paginate_links(array( 'base' => add_query_arg('cpage', '%#%'), 'format' => '', 'type' => 'list', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($total / $per_page), 'current' => $page )); echo '
'; ?>
: