/** * */ function miss_query_posts() { global $wp_query, $irish_framework_params; $post_obj = $wp_query->get_queried_object(); $exclude_categories = miss_exclude_category_string(); $blog_layout = $irish_framework_params->layout['blog']['blog_layout']; $irish_framework_params->offset = $blog_layout == 'blog_layout2' || $blog_layout == 'blog_layout3' ? $irish_framework_params->layout['blog']['featured'] : false; if ($irish_framework_params->offset) { $irish_framework_params->offset = "1"; } // $blog_page = miss_blog_page(); // if( $blog_page == $post_obj->ID ) { // $irish_framework_params->is_blog = true; // } /* Reset offset for categories and search results */ if (is_archive() || is_search()) { $irish_framework_params->offset = "0"; } $paged = miss_get_page_query(); if (!empty($exclude_categories)) { $query_string = "cat={$exclude_categories}&paged={$paged}"; } else { $query_string = "paged={$paged}"; } if (is_home() || is_front_page()) { $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } else { if (!empty($irish_framework_params->offset)) { if ($paged > 1) { $irish_framework_params->offset = 1; //$irish_framework_params->offset = (get_settings('posts_per_page')*$paged)/2+1; } else { $irish_framework_params->offset = 1; } $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } else { $irish_framework_params->offset = "0"; $query_string = $query_string . "&offset={$irish_framework_params->offset}"; } } //print $query_string; if (isset($irish_framework_params->is_blog)) { return query_posts($query_string); } if (is_archive() || is_search()) { $irish_framework_params->archive_search = true; $irish_framework_params->offset = "0"; $args = array_merge($wp_query->query, array('post_type' => get_post_type(), 'category__not_in' => miss_exclude_category_array($minus = false), 'offset' => $irish_framework_params->offset)); return query_posts($args); } elseif (!empty($post_obj->ID)) { $blog_page = miss_blog_page(); if ($blog_page == $post_obj->ID) { $irish_framework_params->is_blog = true; $irish_framework_params->blog_page = $post_obj->ID; if (!empty($irish_framework_params->offset)) { $irish_framework_params->posts_per_page = get_option('posts_per_page'); add_filter('post_limits', 'my_post_limit'); } return query_posts($query_string); } } elseif (is_front_page() && miss_get_setting('frontpage_blog') || !empty($post_obj->ID) && get_option('page_for_posts') == $post_obj->ID) { if (!empty($irish_framework_params->offset)) { $irish_framework_params->posts_per_page = get_option('posts_per_page'); add_filter('post_limits', 'my_post_limit'); } $args = array_merge($wp_query->query, array('post_type' => 'post', 'paged' => $paged, 'offset' => $irish_framework_params->offset, 'category__not_in' => miss_exclude_category_array($minus = false))); return query_posts($args); } return false; }
/** * */ function miss_get_context() { global $wp_query, $post, $irish_framework_params; $blog_page = miss_blog_page(); # If $irish_framework_params->context has been set, don't run through the conditionals again. Just return the variable. if (!empty($irish_framework_params->context)) { if (is_array($irish_framework_params->context)) { return $irish_framework_params->context; } } $irish_framework_params->context = array(); # Front page of the site. if (is_front_page()) { $irish_framework_params->context[] = 'home'; } # Blog page. if (is_home()) { $irish_framework_params->context[] = 'blog'; } # Mysite blog. if (!empty($post->ID) && $blog_page == $post->ID) { $irish_framework_params->context[] = 'blog'; } elseif (is_singular()) { $irish_framework_params->context[] = 'singular'; if (isset($wp_query->post->post_type)) { $irish_framework_params->context[] = "singular-{$wp_query->post->post_type}"; } if (isset($wp_query->post->ID)) { $irish_framework_params->context[] = "singular-{$wp_query->post->post_type}-{$wp_query->post->ID}"; } } elseif (is_archive()) { $irish_framework_params->context[] = 'archive'; # Taxonomy archives. if (is_tax() || is_category() || is_tag()) { $term = $wp_query->get_queried_object(); $irish_framework_params->context[] = 'taxonomy'; $irish_framework_params->context[] = $term->taxonomy; $irish_framework_params->context[] = "{$term->taxonomy}-" . sanitize_html_class($term->slug, $term->term_id); } elseif (is_author()) { $irish_framework_params->context[] = 'user'; $irish_framework_params->context[] = 'user-' . sanitize_html_class(get_the_author_meta('user_nicename', get_query_var('author')), $wp_query->get_queried_object_id()); } else { if (is_date()) { $irish_framework_params->context[] = 'date'; if (is_year()) { $irish_framework_params->context[] = 'year'; } if (is_month()) { $irish_framework_params->context[] = 'month'; } if (get_query_var('w')) { $irish_framework_params->context[] = 'week'; } if (is_day()) { $irish_framework_params->context[] = 'day'; } } if (is_time()) { $irish_framework_params->context[] = 'time'; if (get_query_var('hour')) { $irish_framework_params->context[] = 'hour'; } if (get_query_var('minute')) { $irish_framework_params->context[] = 'minute'; } } } } elseif (is_search()) { $irish_framework_params->context[] = 'search'; } elseif (is_404()) { $irish_framework_params->context[] = 'error-404'; } return $irish_framework_params->context; }