Skip to content
This repository
Browse code

Correct template loading

Can't use `locate_template` directly here because we need templates to
have access to some local variables.
  • Loading branch information...
commit b207e8a170911d07c2a921685097a2cdc6b692de 1 parent 40672a8
authored August 21, 2012

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. 12  webcomic.php
12  webcomic.php
@@ -823,7 +823,9 @@ public function the_content_feed( $content ) {
823 823
 			$feed_size = self::$config[ 'collections' ][ $post->post_type ][ 'feeds' ][ 'size' ];
824 824
 			
825 825
 			
826  
-			if ( !locate_template( array( "webcomic/feed-{$post->post_type}.php", 'webcomic/feed.php' ), true, false ) and $attachments = self::get_attachments( $post->ID ) ) {
  826
+			if ( $template = locate_template( array( "webcomic/feed-{$post->post_type}.php", 'webcomic/feed.php' ) ) ) {
  827
+				require $template;
  828
+			} else {
827 829
 				require self::$dir . '-/php/integrate/feed.php';
828 830
 			}
829 831
 			
@@ -921,7 +923,9 @@ public function the_excerpt( $excerpt ) {
921 923
 		if ( self::$integrate and in_the_loop() and $wp_query->is_main_query() and !is_feed() and $collection = get_post_type( $post ) and isset( self::$config[ 'collections' ][ $collection ] ) ) {
922 924
 			$prepend = $append = '';
923 925
 			
924  
-			if ( !locate_template( array( "webcomic/the_excerpt-{$collection}.php", 'webcomic/the_excerpt.php' ), true, false ) ) {
  926
+			if ( $template = locate_template( array( "webcomic/the_excerpt-{$collection}.php", 'webcomic/the_excerpt.php' ) ) ) {
  927
+				require $template;
  928
+			} else {
925 929
 				require self::$dir . '-/php/integrate/the_excerpt.php';
926 930
 			}
927 931
 		}
@@ -943,7 +947,9 @@ public function the_content( $content ) {
943 947
 		if ( self::$integrate and in_the_loop() and $wp_query->is_main_query() and !is_feed() and $collection = get_post_type( $post ) and isset( self::$config[ 'collections' ][ $collection ] ) ) {
944 948
 			$prepend = $append = '';
945 949
 			
946  
-			if ( !locate_template( array( "webcomic/the_content-{$collection}.php", 'webcomic/the_content.php' ), true, false ) ) {
  950
+			if ( $template = locate_template( array( "webcomic/the_content-{$collection}.php", 'webcomic/the_content.php' ) ) ) {
  951
+				require $template;
  952
+			} else {
947 953
 				require self::$dir . '-/php/integrate/the_content.php';
948 954
 			}
949 955
 			

0 notes on commit b207e8a

Please sign in to comment.
Something went wrong with that request. Please try again.