'. $n .''; } return $output; } ////////////////////////////////////// /** * Compare dates for usort() ASC * @param string $date_1 - format Y-m-d H:i * @param string $date_2 - format Y-m-d H:i * @return int */ public static function compare_sql_dates_asc($date_1, $date_2){ $ad = new DateTime($date_1); $bd = new DateTime($date_2); if ($ad == $bd) { return 0; } return $ad < $bd ? -1 : 1; } ////////////////////////////////////// /** * Compare dates for usort() DESC * @param string $date_1 - format Y-m-d H:i * @param string $date_2 - format Y-m-d H:i * @return int */ public static function compare_sql_dates_desc($date_1, $date_2){ $ad = new DateTime($date_1); $bd = new DateTime($date_2); if ($ad == $bd) { return 0; } return $ad > $bd ? -1 : 1; } /////////////////////////////////////// /** * Get page content. * @param int $post_id * @return string */ public static function get_page_content($post_id) { $post = get_post($post_id); $output = !empty($post) ? apply_filters('the_content', $post->post_content) : ''; return $output; } /////////////////////////////////////// }