@@ -165,7 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
| 167 | 167 | |
| 168 | - } else { |
|
| 168 | + } |
|
| 169 | + else { |
|
| 169 | 170 | |
| 170 | 171 | list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
| 171 | 172 | |
@@ -218,18 +219,22 @@ discard block |
||
| 218 | 219 | if ( ! $pagename && $id ) { |
| 219 | 220 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 220 | 221 | $post = get_queried_object(); |
| 221 | - if ( $post ) |
|
| 222 | - $pagename = $post->post_name; |
|
| 222 | + if ( $post ) { |
|
| 223 | + $pagename = $post->post_name; |
|
| 224 | + } |
|
| 223 | 225 | } |
| 224 | 226 | |
| 225 | 227 | $template = get_post_meta('theme-page-template', $id); |
| 226 | 228 | |
| 227 | - if ( $template != 'index' ) |
|
| 228 | - $templates[] = $template; |
|
| 229 | - if ( $pagename ) |
|
| 230 | - $templates[] = "page-$pagename"; |
|
| 231 | - if ( $id ) |
|
| 232 | - $templates[] = "page-$id"; |
|
| 229 | + if ( $template != 'index' ) { |
|
| 230 | + $templates[] = $template; |
|
| 231 | + } |
|
| 232 | + if ( $pagename ) { |
|
| 233 | + $templates[] = "page-$pagename"; |
|
| 234 | + } |
|
| 235 | + if ( $id ) { |
|
| 236 | + $templates[] = "page-$id"; |
|
| 237 | + } |
|
| 233 | 238 | $templates[] = ''; |
| 234 | 239 | |
| 235 | 240 | // Page |
@@ -245,24 +250,30 @@ discard block |
||
| 245 | 250 | if ( ! $pagename && $id ) { |
| 246 | 251 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 247 | 252 | $post = get_queried_object(); |
| 248 | - if ( $post ) |
|
| 249 | - $pagename = $post->post_name; |
|
| 253 | + if ( $post ) { |
|
| 254 | + $pagename = $post->post_name; |
|
| 255 | + } |
|
| 250 | 256 | } |
| 251 | 257 | |
| 252 | - if ( $template != 'index' ) |
|
| 253 | - $templates[] = $template; |
|
| 254 | - if ( $pagename ) |
|
| 255 | - $templates[] = "page-$pagename"; |
|
| 256 | - if ( $id ) |
|
| 257 | - $templates[] = "page-$id"; |
|
| 258 | + if ( $template != 'index' ) { |
|
| 259 | + $templates[] = $template; |
|
| 260 | + } |
|
| 261 | + if ( $pagename ) { |
|
| 262 | + $templates[] = "page-$pagename"; |
|
| 263 | + } |
|
| 264 | + if ( $id ) { |
|
| 265 | + $templates[] = "page-$id"; |
|
| 266 | + } |
|
| 258 | 267 | $templates[] = 'page'; |
| 259 | 268 | |
| 260 | 269 | |
| 261 | 270 | // Default |
| 262 | 271 | |
| 263 | - else: |
|
| 272 | + else { |
|
| 273 | + : |
|
| 264 | 274 | |
| 265 | 275 | $templates[] = $type; |
| 276 | + } |
|
| 266 | 277 | |
| 267 | 278 | endif; |
| 268 | 279 | |
@@ -292,7 +303,9 @@ discard block |
||
| 292 | 303 | |
| 293 | 304 | preg_match('/classy\-(.*)/', $template_slug, $matches); |
| 294 | 305 | |
| 295 | - if ( $matches && isset($matches[1]) ) return $matches[1]; |
|
| 306 | + if ( $matches && isset($matches[1]) ) { |
|
| 307 | + return $matches[1]; |
|
| 308 | + } |
|
| 296 | 309 | |
| 297 | 310 | return false; |
| 298 | 311 | |
@@ -338,9 +351,11 @@ discard block |
||
| 338 | 351 | |
| 339 | 352 | elseif ( is_paged() && $template = self::get_available_template('paged') ) : |
| 340 | 353 | |
| 341 | - else : |
|
| 354 | + else { |
|
| 355 | + : |
|
| 342 | 356 | |
| 343 | 357 | $template = 'index'; |
| 358 | + } |
|
| 344 | 359 | |
| 345 | 360 | endif; |
| 346 | 361 | |
@@ -361,7 +376,8 @@ discard block |
||
| 361 | 376 | |
| 362 | 377 | return $template; |
| 363 | 378 | |
| 364 | - } else { |
|
| 379 | + } |
|
| 380 | + else { |
|
| 365 | 381 | |
| 366 | 382 | return $template . '.' . $template; |
| 367 | 383 | |
@@ -414,13 +430,15 @@ discard block |
||
| 414 | 430 | |
| 415 | 431 | $scope = array_merge($common_scope, $data); |
| 416 | 432 | |
| 417 | - } else { |
|
| 433 | + } |
|
| 434 | + else { |
|
| 418 | 435 | |
| 419 | 436 | $scope = $common_scope; |
| 420 | 437 | |
| 421 | 438 | } |
| 422 | 439 | |
| 423 | - } else { |
|
| 440 | + } |
|
| 441 | + else { |
|
| 424 | 442 | |
| 425 | 443 | $current_page = self::get_current_page(); |
| 426 | 444 | |
@@ -451,7 +469,9 @@ discard block |
||
| 451 | 469 | |
| 452 | 470 | if ( !empty($filename) ) { |
| 453 | 471 | |
| 454 | - if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) continue; |
|
| 472 | + if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { |
|
| 473 | + continue; |
|
| 474 | + } |
|
| 455 | 475 | |
| 456 | 476 | $template_name = trim($header[1]); |
| 457 | 477 | |