<?php $tax = $wp_query->query["chronosly_category"]; if (!$tax) { $tax = $wp_query->query_vars["chronosly_category"]; } if (!$tax) { $tax = $wp_query->queried_object->chronosly_category; } if (!$tax) { $tax = $wp_the_query->queried_object->chronosly_category; } $wp_query->query("chronosly_category={$tax}&posts_per_page={$limit}&numberposts={$limit}&paged={$paged}"); remove_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); $extra = array("chronosly_category" => $tax); $repeated = Post_Type_Chronosly::get_events_repeated_by_date($limit, $paged, $extra); $elementos = Post_Type_Chronosly::get_days_by_date($wp_query, $repeated, $limit, $paged); $elements = $elementos[0]; $cat_link = "../"; $stilo = "margin:auto;padding:30px;"; if ($Post_Type_Chronosly->settings["chronosly_template_max"]) { $stilo .= "max-width:" . $Post_Type_Chronosly->settings["chronosly_template_max"] . "px;"; } if ($Post_Type_Chronosly->settings["chronosly_template_min"]) { $stilo .= "min-width:" . $Post_Type_Chronosly->settings["chronosly_template_min"] . "px;"; } if (!isset($_REQUEST["shortcode"]) or !$_REQUEST["shortcode"] or isset($_REQUEST["navigation"]) and $_REQUEST["navigation"]) { ?> <div class="ch-header ch-<?php echo $Post_Type_Chronosly->settings["chronosly_titles_template_default"]; ?>
public static function chronosly_templates($template) { global $chronosly_running, $wp_query; $original_query = $wp_query; $settings = unserialize(get_option('chronosly-settings')); $custom_post_type = get_post_type(); if (!$custom_post_type or stripos($custom_post_type, "chronosly") === FALSE) { $obj = $wp_query->query_vars; $custom_post_type = $obj["post_type"]; } wp_register_style('chronosly-front-css' . CHRONOSLY_VERSION, CHRONOSLY_URL . '/css/front_template.css'); wp_register_style('chronosly-custom-css', CHRONOSLY_URL . '/css/custom.css'); wp_register_script('chronosly-gmap', 'http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array('jquery')); wp_register_script('chronosly-scroll', CHRONOSLY_URL . '/js/scroll/jquery.mCustomScrollbar.concat.min.js', array('jquery')); wp_register_style('chronosly-scroll-css', CHRONOSLY_URL . '/js/scroll/jquery.mCustomScrollbar.css'); wp_register_style('chronosly-icons', CHRONOSLY_URL . '/css/icons/styles.css'); wp_register_style('chronosly-fa-icons', "http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"); wp_register_script('chronosly-colorbox', CHRONOSLY_URL . '/js/colorbox/jquery.colorbox.js', array('jquery')); wp_register_style('chronosly-colorbox-css', CHRONOSLY_URL . '/js/colorbox/css/colorbox.css'); wp_register_style('chronosly-templates-base', CHRONOSLY_URL . '/css/templates_base.css'); /* if($base = Post_Type_Chronosly::id_for_base($obj)){ Post_Type_Chronosly::base_template_code($base); }*/ if (stripos($template, "shortcode") !== FALSE or self::POST_TYPE === $custom_post_type or "chronosly_category" === $custom_post_type or "chronosly_organizer" === $custom_post_type or "chronosly_places" === $custom_post_type or "chronosly_calendar" === $custom_post_type) { if (stripos($template, "shortcode") !== FALSE) { wp_print_styles('chronosly-front-css' . CHRONOSLY_VERSION); if (file_exists(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "custom.css")) { wp_print_styles('chronosly-custom-css'); } if (!$settings["chronosly-disable-gmap-js"]) { wp_enqueue_script('chronosly-gmap'); } wp_enqueue_script('chronosly-scroll'); wp_print_styles('chronosly-scroll-css'); wp_print_styles('chronosly-icons'); wp_print_styles('chronosly-fa-icons'); wp_enqueue_script('chronosly-colorbox'); wp_print_styles('chronosly-colorbox-css'); if (!is_admin() or stripos($_SERVER["REQUEST_URI"], "wp-admin") === FALSE) { wp_register_script('chronosly-front-js', CHRONOSLY_URL . '/js/front.js', array('jquery')); $translation_array = array("scrollOnOpen" => !$settings["disable_slide_on_show"], "weburl" => get_site_url(), "calendarurl" => Post_Type_Chronosly_Calendar::get_permalink(), 'ajaxurl' => admin_url('admin-ajax.php')); wp_localize_script('chronosly-front-js', 'translated1', $translation_array); wp_enqueue_script('chronosly-front-js'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-ui-tooltip'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-draggable'); } wp_print_styles('chronosly-templates-base'); //templates and addons css } else { wp_enqueue_style('chronosly-front-css' . CHRONOSLY_VERSION); if (file_exists(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "custom.css")) { wp_enqueue_style('chronosly-custom-css'); } if (!$settings["chronosly-disable-gmap-js"]) { wp_enqueue_script('chronosly-gmap'); } wp_enqueue_script('chronosly-scroll'); wp_enqueue_style('chronosly-scroll-css'); wp_enqueue_style('chronosly-icons'); wp_enqueue_style('chronosly-fa-icons'); wp_enqueue_script('chronosly-colorbox'); wp_enqueue_style('chronosly-colorbox-css'); if (!is_admin() or stripos($_SERVER["REQUEST_URI"], "wp-admin") === FALSE) { wp_register_script('chronosly-front-js', CHRONOSLY_URL . '/js/front.js', array('jquery')); $translation_array = array("scrollOnOpen" => !$settings["disable_slide_on_show"], "weburl" => get_site_url(), "calendarurl" => Post_Type_Chronosly_Calendar::get_permalink(), 'ajaxurl' => admin_url('admin-ajax.php')); wp_localize_script('chronosly-front-js', 'translated1', $translation_array); wp_enqueue_script('chronosly-front-js'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-ui-tooltip'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-draggable'); } wp_enqueue_style('chronosly-templates-base'); //templates and addons css } do_action("chronosly_custom_frontend_css"); Post_Type_Chronosly::get_shortcode_base(); if (stripos($template, "shortcode") === FALSE and !is_search()) { $chronosly_running = 1; } else { if (stripos($template, "shortcode") !== FALSE) { $chronosly_shortcode = 1; } } $wp_query = $original_query; // echo $template." ".$chronosly_shortcode." "; if (is_tax("chronosly_category") and !$chronosly_shortcode or $template == "shortcode_category" or $template == "shortcode_categories" or $_REQUEST["shortcode_category"] or $_REQUEST["shortcode_categories"]) { if (is_tax("chronosly_category", "list_all_cats") or $template == "shortcode_categories" or $_REQUEST["shortcode_categories"]) { //falta añadir aqui los shortcodes... //esto esta replicado en chronosly category, en template redirect, por lo que no hace caso de esto aqui if ($template != "shortcode_categories" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "archive-category-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "archive-category-chronosly.php"; } if ($template != "shortcode_categories" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_categories" or $_REQUEST["shortcode_categories"]) { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'archive-category-chronosly.php'; } } else { //add_action( 'posts_orderby', array("Post_Type_Chronosly",'add_custom_orderby') ); add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); if ($template != "shortcode_category" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "single-category-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "single-category-chronosly.php"; } if ($template != "shortcode_category" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_category" or $_REQUEST["shortcode_category"]) { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-category-chronosly.php'; } } } else { if (is_tax("chronosly_tag") and !$chronosly_shortcode) { if (!has_action('posts_orderby', array("Post_Type_Chronosly", 'add_custom_orderby'))) { add_action('posts_orderby', array("Post_Type_Chronosly", 'add_custom_orderby')); } if (!has_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars'))) { add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); } return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-tag-chronosly.php'; } else { if (self::POST_TYPE === $custom_post_type and !$chronosly_shortcode or $template == "shortcode_event" or $template == "shortcode_events") { if (is_archive() or $template == "shortcode_events") { add_action('posts_orderby', array("Post_Type_Chronosly", 'add_custom_orderby')); add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); if ($template != "shortcode_events" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "archive-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "archive-chronosly.php"; } if ($template != "shortcode_events" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_events") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'archive-chronosly.php'; } } else { if (is_single() or $template == "shortcode_event") { if ($template != "shortcode_event" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "single-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "single-chronosly.php"; } if ($template != "shortcode_event" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_event") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-chronosly.php'; } } } } else { if ("chronosly_organizer" === $custom_post_type and !$chronosly_shortcode or $template == "shortcode_organizer" or $template == "shortcode_organizers") { add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); if (is_archive() or $template == "shortcode_organizers") { if ($template != "shortcode_organizers" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "archive-organizer-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "archive-orgabizer-chronosly.php"; } if ($template != "shortcode_organizers" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_organizers") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'archive-organizer-chronosly.php'; } } else { if (is_single() or $template == "shortcode_organizer") { if ($template != "shortcode_organizer" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "single-organizer-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "single-organizer-chronosly.php"; } if ($template != "shortcode_organizer" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_organizer") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-organizer-chronosly.php'; } } } } else { if ("chronosly_places" === $custom_post_type and !$chronosly_shortcode or $template == "shortcode_place" or $template == "shortcode_places") { add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); if (is_archive() or $template == "shortcode_places") { if ($template != "shortcode_places" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "archive-places-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "archive-places-chronosly.php"; } if ($template != "shortcode_places" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_places") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'archive-places-chronosly.php'; } } else { if (is_single() or $template == "shortcode_place") { if ($template != "shortcode_place" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "single-places-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "single-places-chronosly.php"; } if ($template != "shortcode_place" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_place") { return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-places-chronosly.php'; } } } } else { if ("chronosly_calendar" === $custom_post_type and !$chronosly_shortcode or $template == "shortcode_calendar") { if (!has_action('posts_orderby', array("Post_Type_Chronosly", 'add_custom_orderby'))) { add_action('posts_orderby', array("Post_Type_Chronosly", 'add_custom_orderby')); } if ($template != "shortcode_calendar" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "calendar-chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "calendar-chronosly.php"; } if ($template != "shortcode_calendar" and file_exists(get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php")) { return get_template_directory() . DIRECTORY_SEPARATOR . "chronosly.php"; } if (!$settings["chronosly-base-templates-id"] or $_REQUEST["js_render"] or $template == "shortcode_calendar") { add_action('wp_head', array("Post_Type_Chronosly", 'noindex')); return CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'calendar-chronosly.php'; } } } } } } } } return $template; }
public function run_templates($type, $args) { global $wp_query, $Post_Type_Chronosly, $pastformat; $pastformat = 0; //para enseñar en formato eventos pasados if (isset($_REQUEST["chronosly_event_list_time"]) and $_REQUEST["chronosly_event_list_time"] == "past") { $pastformat = 1; } $_REQUEST["shortcode"] = 1; $q = array(); if ($args["id"]) { $q["post__in"] = explode(",", $args["id"]); } if ($type == "place" and $args["place"]) { $ids = explode(",", $args["place"]); if ($q["post__in"]) { $q["post__in"] = array_merge($q["post__in"], $ids); } else { $q["post__in"] = $ids; } } if ($type == "organizer" and $args["organizer"]) { $ids = explode(",", $args["organizer"]); if ($q["post__in"]) { $q["post__in"] = array_merge($q["post__in"], $ids); } else { $q["post__in"] = $ids; } } if ($args["author"]) { $q["author"] = $args["author"]; } if ($args["exclude"]) { $q["post__not_in"] = explode(",", $args["exclude"]); } if ($args["category"]) { $_REQUEST["category"] = $args["category"]; } if ($args["organizer"]) { $_REQUEST["organizer"] = $args["organizer"]; } if ($args["place"]) { $_REQUEST["place"] = $args["place"]; } if ($args["count"]) { $q['posts_per_page'] = $args["count"]; $q['numberposts'] = $args["count"]; $_REQUEST["count"] = $args["count"]; } if ($args["pagination"]) { //$q['posts_per_page']=$args["count"]; $_REQUEST['pagination'] = 1; } if (isset($_REQUEST["page"])) { //$q['posts_per_page']=$args["count"]; $q['paged'] = $_REQUEST['page']; } if ($args["before_events"]) { $_REQUEST["before_events"] = 1; } if ($args["after_events"]) { $_REQUEST["after_events"] = 1; } if ($args["featured"]) { if ($args["featured"] == "yes") { $feat = 1; } else { $feat = ""; } $q['post_meta_like']["featured"] = $feat; $_REQUEST["featured"] = $args["featured"]; } if (isset($args["price_min"])) { $q['post_meta_price_min'] = $args["price_min"]; $_REQUEST["ch-price-min"] = $args["price_min"]; } if (isset($args["price_max"])) { $q['post_meta_price_max'] = $args["price_max"]; $_REQUEST["ch-price-max"] = $args["price_max"]; } if (is_user_logged_in()) { $q["post_status"] = array('publish', 'private'); } switch ($type) { case "calendar": if (is_user_logged_in()) { new WP_Query("post_type=chronosly_calendar&post_status=publish,private"); } else { $wp_query = new WP_Query("post_type=chronosly_calendar"); } include Post_Type_Chronosly::chronosly_templates("shortcode_calendar"); break; case "event": if ($args["single"]) { if (is_user_logged_in()) { query_posts("post_type=chronosly&p=" . $args["id"] . "&post_status=publish,private"); } else { query_posts("post_type=chronosly&p=" . $args["id"]); } include Post_Type_Chronosly::chronosly_templates("shortcode_event"); } else { add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); $q["post_type"] = "chronosly"; $q["posts_per_page"] = -1; $wp_query = new WP_Query($q); include Post_Type_Chronosly::chronosly_templates("shortcode_events"); } break; case "organizer": if ($args["single"]) { if (is_user_logged_in()) { query_posts("post_type=chronosly_organizer&p=" . $args["id"] . "&post_status=publish,private"); } else { query_posts("post_type=chronosly_organizer&p=" . $args["id"]); } include Post_Type_Chronosly::chronosly_templates("shortcode_organizer"); } else { if (!has_action('posts_orderby', array("Post_Type_Chronosly_Organizer", 'add_custom_organizers_orderby'))) { add_action('posts_orderby', array("Post_Type_Chronosly_Organizer", 'add_custom_organizers_orderby')); } $q["post_type"] = "chronosly_organizer"; $wp_query = new WP_Query($q); if (has_action('posts_orderby', array("Post_Type_Chronosly_Organizer", 'add_custom_organizers_orderby'))) { remove_action('posts_orderby', array("Post_Type_Chronosly_Organizer", 'add_custom_organizers_orderby')); } include Post_Type_Chronosly::chronosly_templates("shortcode_organizers"); } break; case "place": if ($args["single"]) { if (is_user_logged_in()) { query_posts("post_type=chronosly_places&p=" . $args["id"] . "&post_status=publish,private"); } else { query_posts("post_type=chronosly_places&p=" . $args["id"]); } include Post_Type_Chronosly::chronosly_templates("shortcode_place"); } else { if (!has_action('posts_orderby', array("Post_Type_Chronosly_Places", 'add_custom_places_orderby'))) { add_action('posts_orderby', array("Post_Type_Chronosly_Places", 'add_custom_places_orderby')); } $q["post_type"] = "chronosly_places"; $wp_query = new WP_Query($q); if (has_action('posts_orderby', array("Post_Type_Chronosly_Places", 'add_custom_places_orderby'))) { remove_action('posts_orderby', array("Post_Type_Chronosly_Places", 'add_custom_places_orderby')); } include Post_Type_Chronosly::chronosly_templates("shortcode_places"); } break; case "category": if ($args["single"]) { $cat = get_term($args["id"], "chronosly_category"); $wp_query->set("chronosly_category", $cat->slug); include Post_Type_Chronosly::chronosly_templates("shortcode_category"); } else { $wp_query = new WP_Query($q); include Post_Type_Chronosly::chronosly_templates("shortcode_categories"); } break; } wp_reset_query(); //reset the query status }
function list_all_categories() { if (is_main_query() and get_query_var("chronosly_category") != "") { wp_register_style('chronosly-front-css' . CHRONOSLY_VERSION, CHRONOSLY_URL . '/css/front_template.css'); wp_enqueue_style('chronosly-front-css' . CHRONOSLY_VERSION); if (file_exists(CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "custom.css")) { wp_register_style('chronosly-custom-css', CHRONOSLY_URL . '/css/custom.css'); wp_enqueue_style('chronosly-custom-css'); } if (!$settings["chronosly-disable-gmap-js"]) { wp_register_script('chronosly-gmap', 'http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array('jquery')); wp_enqueue_script('chronosly-gmap'); } wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-ui-tooltip'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-draggable'); wp_register_style('chronosly-icons', CHRONOSLY_URL . '/css/icons/styles.css'); wp_enqueue_style('chronosly-icons'); wp_register_style('chronosly-fa-icons', "http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"); wp_enqueue_style('chronosly-fa-icons'); if (!is_admin() or stripos($_SERVER["REQUEST_URI"], "wp-admin") === FALSE) { wp_register_script('chronosly-front-js', CHRONOSLY_URL . '/js/front.js', array('jquery')); $translation_array = array("weburl" => get_site_url(), "calendarurl" => Post_Type_Chronosly_Calendar::get_permalink(), 'ajaxurl' => admin_url('admin-ajax.php')); wp_localize_script('chronosly-front-js', 'translated1', $translation_array); wp_enqueue_script('chronosly-front-js'); } wp_register_style('chronosly-templates-base', CHRONOSLY_URL . '/css/templates_base.css'); wp_enqueue_style('chronosly-templates-base'); //templates and addons css do_action("chronosly_custom_frontend_css"); $sets = unserialize(get_option("chronosly-settings")); if (isset($sets["chronosly-base-templates-id"]) and $sets["chronosly-base-templates-id"] != 0 and !$_REQUEST["js_render"]) { if (get_query_var("chronosly_category") == "list_all_cats") { $_REQUEST["shortcode_categories"] = 1; } else { $_REQUEST["shortcode_category"] = 1; } Post_Type_Chronosly::base_template_code("ch-category"); //exit; } else { if (get_query_var("chronosly_category") == "list_all_cats") { include CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'archive-category-chronosly.php'; } else { add_action('pre_get_posts', array("Post_Type_Chronosly", 'add_custom_post_vars')); include CHRONOSLY_PATH . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . 'single-category-chronosly.php'; } exit; } } }
public static function get_array_days_by_repeated($year, $month, $week, $query, $elements) { $settings = unserialize(get_option("chronosly-settings")); if (!$month and !$week) { while ($query->have_posts()) { $query->the_post(); if (is_array($elements["ids"]) and in_array(get_the_ID(), $elements["ids"])) { continue; } //if the day is already done. $meta = get_post_meta(get_the_ID()); if (isset($meta["ev-from"][0])) { //Miramos cuando empieza y acaba y generamos sus repeticiones para ver si hay que mostrarlo $start = strtotime($meta["ev-from"][0]); $end = strtotime($meta["ev-to"][0]); if ($settings["chronosly_week_start"] == 1) { //$start -= (60*60*24); //$end -= (60*60*24); } //do repeats if (Post_Type_Chronosly::filter(get_the_ID())) { $elements = Post_Type_Chronosly_Calendar::repeats($meta, $year, $month, $week, $start, $end, get_the_ID(), $elements, 1); } } } } else { if ($week) { while ($query->have_posts()) { $query->the_post(); if (is_array($elements["ids"]) and in_array(get_the_ID(), $elements["ids"])) { continue; } //if the day is already done. $meta = get_post_meta(get_the_ID()); if (isset($meta["ev-from"][0])) { $start = strtotime($meta["ev-from"][0]); $end = strtotime($meta["ev-to"][0]); if ($settings["chronosly_week_start"] == 1) { // $start -= (60*60*24); // $end -= (60*60*24); } //do repeats if (Post_Type_Chronosly::filter(get_the_ID())) { $elements = Post_Type_Chronosly_Calendar::repeats($meta, $year, $month, $week, $start, $end, get_the_ID(), $elements, 1); } } } } else { if ($month) { while ($query->have_posts()) { $query->the_post(); if (is_array($elements["ids"]) and in_array(get_the_ID(), $elements["ids"])) { continue; } //if the day is already done. $meta = get_post_meta(get_the_ID()); if (isset($meta["ev-from"][0])) { $start = strtotime($meta["ev-from"][0]); $end = strtotime($meta["ev-to"][0]); if ($settings["chronosly_week_start"] == 1) { //$start -= (60*60*24); //$end -= (60*60*24); } if (Post_Type_Chronosly::filter(get_the_ID())) { $elements = Post_Type_Chronosly_Calendar::repeats($meta, $year, $month, $week, $start, $end, get_the_ID(), $elements, 1); } } } } } } return $elements; }