user_nicename}.php"; $templates[] = "author-{$author->ID}.php"; $templates[] = 'author.php'; self::$request = $templates; } // hooked to handle page templates function handle_category($template) { $category = get_queried_object(); $templates = array(); $templates[] = "category-{$category->slug}.php"; $templates[] = "category-{$category->term_id}.php"; $templates[] = 'category.php'; self::$request = $templates; } // for tag tempaltes function handle_tag() { $tag = get_queried_object(); $templates = array(); $templates[] = "tag-{$tag->slug}.php"; $templates[] = "tag-{$tag->term_id}.php"; $templates[] = 'tag.php'; self::$request = $templates; } // attachment pages, not sure what to do with this. // needs some additional logic so blueprint can handle // all the different template types function handle_attachment() { global $posts; $type = explode('/', $posts[0]->post_mime_type); if ( $template = get_query_template($type[0]) ) return $template; elseif ( $template = get_query_template($type[1]) ) return $template; elseif ( $template = get_query_template("$type[0]_$type[1]") ) return $template; else self::$request = $template; } // hooked to handle single templates function handle_single() { $object = get_queried_object(); $templates = array(); $templates[] = "single-{$object->post_type}.php"; $templates[] = "single.php"; self::$request = $templates; // return self::router('single.php'); } // hooked to handle page templates function handle_page($template) { // this is a direct copy and paste from WP. // becuase wordpress isn't verbose about what it // discovers it does this reuqest. We'll need // to duplicate it. $id = get_queried_object_id(); $template = get_post_meta($id, '_wp_page_template', true); $pagename = get_query_var('pagename'); if ( !$pagename && $id > 0 ) { // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object $post = get_queried_object(); $pagename = $post->post_name; } if ( 'default' == $template ) $template = ''; PLS_Debug::add_msg("Of type Page, searching for:"); PLS_Debug::add_msg($template); $templates = array(); if ( !empty($template) && !validate_file($template) ) $templates[] = $template; if ( $pagename ) $templates[] = "page-$pagename.php"; if ( $id ) $templates[] = "page-$id.php"; $templates[] = 'page.php'; // The possible templates are stored in the // request var so router can use them later // when the filter is called to decide // which pages to look for. self::$request = $templates; } function handle_taxonomy() { $term = get_queried_object(); $taxonomy = $term->taxonomy; $templates = array(); $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; $templates[] = "taxonomy-$taxonomy.php"; $templates[] = 'taxonomy.php'; self::$request = $templates; } /** * A class that adds theme wrapping functionality * * This allows theme developers to avoid code repetition by adding the common * surrounding code from templates to a wrapper.php file. * * Based on the ideas of http://scribu.net/wordpress/theme-wrappers.html * Modified for Blueprints needs. * */ static function wrapper() { PLS_Debug::add_msg('Wrapper used..'); $base = ''; $templates = array(); // we need to construct a list of wrapper files // we're looking for. The basic construction is: // Looks for wrapper-[base].php and then // for blueprint/wrappers/wrapper-[base].php // // This is done for situations when we can have multiple // templates used for the same file. Like pages, archives, // etc.. foreach ( (array) self::$request as $variation) { $base = substr( basename( $variation), 0, -4 ); $templates[] = sprintf( 'wrapper-%s', $variation ); } $templates[] ='wrapper.php'; // if wrapper is being used, it will load attempt // to load the various wrapper iterations. // wrapper needs to have PLS_Route::handle_dynamic to // actually load the requested page after wrapper is // loaded. return self::router( $templates, true ); } // end class } ?>