function cftl_intercept_get_posts(&$query_obj)
{
    global $cftl_previous, $wp_rewrite;
    if (!$query_obj->is_main_query()) {
        return;
    }
    remove_action('pre_get_posts', 'cftl_intercept_get_posts');
    /**
     * NOTE: We need the explicit is_tax, is_tag, is_category checks below as
     * is_tax is not set on tag or category queries. (as of WP 3.4)
     */
    if (!$query_obj->is_feed && ($query_obj->is_tax || $query_obj->is_tag || $query_obj->is_category)) {
        $landing = false;
        $qv = $query_obj->query_vars;
        $a = is_object($wp_rewrite);
        $b = $wp_rewrite->using_permalinks();
        if (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) {
            // Permalink rewrites kill paged=1
            $landing = cftl_find_override_page($query_obj);
        }
        if (!isset($qv['paged']) || (int) $qv['paged'] >= 1) {
            // Only handle the landing page, not an explicit call to page 1
            if ($landing) {
                add_filter('redirect_canonical', 'cftl_maintain_paged');
            }
            return;
        }
        if (!$landing) {
            $landing = cftl_find_override_page($query_obj);
        }
        if (!$landing) {
            return;
        }
        $cftl_previous['query'] = $query_obj->query;
        $cftl_previous['query_vars'] = $query_obj->query_vars;
        $cftl_previous['queried_object'] = $query_obj->get_queried_object();
        $query = 'post_type=cftl-tax-landing&p=' . absint($landing->ID);
        $query_obj->parse_query($query);
        add_filter('redirect_canonical', 'cftl_abort_redirect_canonical');
        $page_template = get_post_meta($landing->ID, '_wp_page_template', true);
        if (!empty($page_template)) {
            add_filter('template_include', 'cftl_intercept_template_loader');
        }
    }
}
function cftl_intercept_get_posts(&$query_obj)
{
    if (is_admin()) {
        return false;
    }
    global $cftl_previous, $wp_rewrite;
    if (!$query_obj->is_main_query()) {
        return false;
    }
    remove_action('pre_get_posts', 'cftl_intercept_get_posts');
    /**
     * NOTE: We need the explicit is_tax, is_tag, is_category checks below as
     * is_tax is not set on tag or category queries. (as of WP 3.4)
     */
    if (!$query_obj->is_feed && ($query_obj->is_tax || $query_obj->is_tag || $query_obj->is_category)) {
        //double-checking due to other intercepts
        if (!isset($query_obj->tax_query->queries)) {
            return;
        }
        $landing = false;
        $qv = $query_obj->query_vars;
        if (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) {
            // Permalink rewrites kill paged=1
            $landing = cftl_find_override_page($query_obj);
        }
        $cftl_previous['pageholder'] = $qv['paged'];
        if (!$landing && isset($query_obj->tax_query->queries)) {
            $landing = cftl_find_override_page($query_obj);
        }
        if (!$landing) {
            return;
        }
        $cftl_previous['query'] = $query_obj->query;
        $cftl_previous['query_vars'] = $query_obj->query_vars;
        $cftl_previous['queried_object'] = $query_obj->get_queried_object();
        $query = 'post_type=cftl-tax-landing&p=' . absint($landing->ID);
        $query_obj->parse_query($query);
        add_filter('redirect_canonical', '__return_false');
        $page_template = get_post_meta($landing->ID, '_wp_page_template', true);
        if (!empty($page_template)) {
            add_filter('template_include', 'cftl_intercept_template_loader');
        }
    }
}