class="omo_wrap omoX_wrap">

post_title;?>

$offset, 'cat' => $cur_cat_id, 'posts_per_page' => $PAGE_SIZE, 'orderby' => 'meta_value_num', 'meta_key' => 'duration', 'order' => 'DESC' ); $IS_USE_WP_QUERY_CLASS = false; if($IS_USE_WP_QUERY_CLASS){ $query = new WP_Query($query_args); }else{ $IS_UNDER_OMO_AI_FORUM_CAT = $cur_cat_id==OMO_AI_FORUM_CAT_ID; if(!$IS_UNDER_OMO_AI_FORUM_CAT){ $IS_UNDER_OMO_AI_FORUM_CAT = get_category($cur_cat_id)->parent==OMO_AI_FORUM_CAT_ID; } $order_direction = $IS_UNDER_OMO_AI_FORUM_CAT ? 'ASC' : 'DESC'; $sql = <<get_results($sql); $totalcount = $wpdb->get_row('SELECT FOUND_ROWS() AS c'); $totalcount = $totalcount->c; #### $after1m_ymd = date('Y/m/d', strtotime('+31 days')); $today = date('Y/m/d'); $sql = str_replace('WHERE 1 AND', 'WHERE 1 AND durationymd>="'.$today.'" AND durationymd<="'.$after1m_ymd.'" AND', $sql); $sql = str_replace('ORDER BY duration DESC', 'ORDER BY duration ASC', $sql); $recent_posts = $wpdb->get_results($sql); } if (!$IS_UNDER_OMO_AI_FORUM_CAT and $recent_posts) { echo'

🍀 最近一個月內的場次:

'; foreach ($recent_posts as $post) { echo display_omo_card2($post); } echo'

🌳 活動總覽:

'; } $ary_signup_info = []; #key is sub_term_id, value is info if (is_ai_forum_pages()) { foreach($posts as$_){ $signup_link = get_post_meta($_->ID, 'signup_link', true); if($signup_link){ $signup_start = get_post_meta($_->ID, 'signup_start', true); $signup_end = get_post_meta($_->ID, 'signup_end', true); break; } } if (is_show_omo_signup_button($_->ID, $signup_link)) { echo '
我要報名
'; } } while ( $IS_USE_WP_QUERY_CLASS ? $query->have_posts() : ($row = array_shift($posts)) ) { if ($IS_USE_WP_QUERY_CLASS) { $query->the_post(); } else { $post = get_post($row->ID); } ####### start $ary_signup_info ####### /* $sub_term_id = NULL; foreach(get_the_category($post->ID) as $c){ if($c->term_id!=OMO_AI_FORUM_CAT_ID){ $sub_term_id = $c->term_id; break; } } if (!isset($ary_signup_info[$sub_term_id])) { $ary_sibling = []; foreach(get_posts(['category'=>$sub_term_id, 'posts_per_page'=>99])as$sibling){ $ary_sibling[get_post_meta($sibling->ID, 'duration',true)] = $sibling->ID; } ksort($ary_sibling); $first_sibling = $ary_sibling[0]; $ary_signup_info[$sub_term_id] = [ 'signup_link'=>get_post_meta($post->ID, 'signup_link', true), 'signup_fee'=>get_post_meta($post->ID, 'signup_fee', true), ]; } */ ####### end $ary_signup_info ####### echo display_omo_card2($post); } $a = explode('?', $_SERVER['REQUEST_URI']); $url_wo_querystring = $a[0]; $querystring = $a[1]; echo v2_display_pager( [$url_wo_querystring, $querystring], $paged, $IS_USE_WP_QUERY_CLASS ? $query->found_posts : $totalcount, $PAGE_SIZE, DEFAULT_PAGER_MORE_PAGE_N, ['is_querystring_pagenum'=>true] ); ?>