Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Save both template and stylesheet.

This way we don't have to instantiate WP_Theme on every page request.
  • Loading branch information...
commit 7d3ba3918121fe5c78754a0f012ab3b9d21fd2ae 1 parent b98afc1
Michael Sisk authored
Showing with 5 additions and 8 deletions.
  1. +3 −2 -/php/config.php
  2. +2 −6 webcomic.php
5 -/php/config.php
View
@@ -450,9 +450,10 @@ public function collection_theme() {
<?php
foreach ( wp_get_themes() as $theme ) {
printf(
- '<option value="%s"%s>%s</option>',
+ '<option value="%s|%s"%s>%s</option>',
+ $theme[ 'Template' ],
$theme[ 'Stylesheet' ],
- selected( $theme[ 'Stylesheet' ], self::$config[ 'collections' ][ $_GET[ 'post_type' ] ][ 'theme' ], false ),
+ selected( $theme[ 'Template' ] . '|' . $theme[ 'Stylesheet' ], self::$config[ 'collections' ][ $_GET[ 'post_type' ] ][ 'theme' ], false ),
esc_html( $theme[ 'Name' ] )
);
}
8 webcomic.php
View
@@ -575,11 +575,7 @@ public function template_redirect() {
* @hook template
*/
public function template( $theme ) {
- if ( self::$collection and self::$config[ 'collections' ][ self::$collection ][ 'theme' ] ) {
- return ( $child = new WP_Theme( get_stylesheet_directory(), '' ) and $child->get( 'Template' ) ) ? $child->get( 'Template' ) : self::$config[ 'collections' ][ self::$collection ][ 'theme' ];
- }
-
- return $theme;
+ return ( self::$collection and self::$config[ 'collections' ][ self::$collection ][ 'theme' ] ) ? substr( self::$config[ 'collections' ][ self::$collection ][ 'theme' ], 0, strpos( self::$config[ 'collections' ][ self::$collection ][ 'theme' ], '|' ) ) : $theme;
}
/** Return the appropriate theme ID for custom collection themes.
@@ -591,7 +587,7 @@ public function template( $theme ) {
* @hook stylesheet
*/
public function stylesheet( $theme ) {
- return ( self::$collection and self::$config[ 'collections' ][ self::$collection ][ 'theme' ] ) ? self::$config[ 'collections' ][ self::$collection ][ 'theme' ] : $theme;
+ return ( self::$collection and self::$config[ 'collections' ][ self::$collection ][ 'theme' ] ) ? substr( self::$config[ 'collections' ][ self::$collection ][ 'theme' ], strpos( self::$config[ 'collections' ][ self::$collection ][ 'theme' ], '|' ) + 1 ) : $theme;
}
/** Integrate webcomics into the main site feed.
Please sign in to comment.
Something went wrong with that request. Please try again.