function sfhiv_add_event_filter() { $archive_type = mini_archive_on_page(get_the_ID()); if (is_page() && $archive_type && $archive_type == 'event') { get_template_part("nav", "event"); } }
function sfhiv_draw_taxonomy_query_menu($tax_name, $query, $args = array()) { if (!is_object_in_taxonomy($query->query_vars['post_type'], $tax_name)) { return; } if (!isset($args['include'])) { $query = sfhiv_remove_url_vars_from_query($query, array($tax_name)); $query = sfhiv_unpage_query($query); $categories = sfhiv_get_taxonomy_in($query, $tax_name, 'ids'); $args['include'] = implode(",", $categories); if (!isset($args['min_display'])) { $args['min_display'] = 2; } if (count($categories) < $args['min_display']) { return; } } if (!isset($args['base_link'])) { if (is_page() && mini_archive_on_page(get_the_ID())) { $args['base_link'] = get_permalink(); } else { $args['base_link'] = get_post_type_archive_link($query->query_vars['post_type']); } } if (!isset($args['title_li'])) { $taxonomies = get_taxonomies(array('name' => $tax_name), 'objects'); foreach ($taxonomies as $taxonomy) { $args['title_li'] = $taxonomy->label; } } $args = array_merge(array('taxonomy' => $tax_name, 'show_all_link' => true), $args); sfhiv_draw_taxonomy_menu($args); }
function mini_archive_draw() { global $wp_query; if (is_page() && mini_archive_on_page()) { $archive_type = get_post_meta(get_the_ID(), 'mini_archive', true); if ($archive_type == 'user') { $users = mini_archive_get_users(); $locations = array('/mini_archive-users.php'); $template = locate_template($locations); if ($template == "") { include MINI_ARCHIVE_PLUGIN_DIR . '/templates/mini_archive/mini_archive-users.php'; } else { include $template; } } else { $query = mini_archive_get_query(get_the_ID()); if ($query) { $locations = array('/templates/mini_archive/' . $archive_type . '.php', '/mini_archive/' . $archive_type . '.php', '/mini_archive-' . $archive_type . '.php', '/templates/archive/' . $archive_type . '.php', '/archive/' . $archive_type . '.php', '/archive-' . $archive_type . '.php', '/templates/mini_archive/loop.php', '/mini_archive/loop.php', '/mini_archive-loop.php', '/mini_archive.php', '/templates/archive/loop.php', '/archive/loop.php', '/archive-loop.php', '/archive.php'); $template = locate_template($locations); if ($template == "") { include MINI_ARCHIVE_PLUGIN_DIR . '/templates/mini_archive/mini_archive.php'; } else { $original_query = $wp_query; $wp_query = $query; include $template; $wp_query = $original_query; wp_reset_postdata(); } } } } }
function mini_archive_get_users($ID = false) { if (!$ID) { $ID = get_the_ID(); } $archive_type = mini_archive_on_page($ID); if (!$archive_type) { return false; } $args = array(); $filters = mini_archive_get_filters($ID); foreach ($filters as $filter) { $args = apply_filters('mini_archive_filter_user_query', $args, $filter); } return get_users($args); }
function sfhiv_get_archive_query() { global $wp_query; $query = false; if (is_page()) { $archive_type = mini_archive_on_page(get_the_ID()); if ($archive_type) { $query = mini_archive_get_query(get_the_ID()); } } if (is_archive()) { $wp_query->rewind_posts(); $query = $wp_query; } return $query; }
function sfhiv_add_mini_archive_menu() { global $post; $archive_type = mini_archive_on_page(get_the_ID()); if ($archive_type && !is_home()) { $output_archive = false; $query = mini_archive_get_query(get_the_ID()); if (!in_array($archive_type, array('sfhiv_event'))) { $years = sfhiv_get_taxonomy_in($query, 'sfhiv_year', 'ids'); if (count($years) > 1) { $output_archive = true; sfhiv_draw_taxonomy_menu(array('taxonomy' => 'sfhiv_year', 'title_li' => false, 'include' => implode(',', $years), 'show_all_link' => false, 'base_link' => get_permalink(get_the_ID()))); } } $archive_filters = mini_archive_get_filters(); foreach ($archive_filters as $filter) { if (!$output_archive) { $taxes = sfhiv_get_taxonomy_in($query, $filter['type'], 'ids'); if (count($taxes) > 1) { $output_archive = true; sfhiv_draw_taxonomy_menu(array('taxonomy' => $filter['type'], 'title_li' => false, 'include' => implode(',', $taxes), 'show_all_link' => false, 'base_link' => get_permalink(get_the_ID()))); } } } if (is_home()) { $output_archive = true; } if (!$output_archive && !in_array($archive_type, array('sfhiv_service', 'sfhiv_service_hour'))) { $query = mini_archive_get_query(get_the_ID(), array('posts_per_page' => 3)); $org_post = $post; ?> <nav><ul class="menu"><?php foreach ($query->posts as $post) { get_template_part('list-item', get_post_type()); } $post = $org_post; ?> </ul></nav><?php } } }