| Conditions | 6 |
| Paths | 10 |
| Total Lines | 50 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 15 | public function __construct() { |
||
| 16 | $post_type = get_post_type(); |
||
| 17 | |||
| 18 | $options = array(); |
||
| 19 | |||
| 20 | switch ( $post_type ) { |
||
| 21 | case 'attachment': |
||
| 22 | $attachment = get_queried_object(); |
||
| 23 | |||
| 24 | if ( ! empty( $attachment->post_mime_type ) ) { |
||
| 25 | $mime_type = $attachment->post_mime_type; |
||
| 26 | $types = explode( '/', $mime_type, 2 ); |
||
| 27 | |||
| 28 | $options[] = 'single/' . $types[0]; |
||
| 29 | $options[] = $types[0]; |
||
| 30 | |||
| 31 | if ( ! empty( $types[1] ) ) { |
||
| 32 | $options[] = 'single/' . $types[1]; |
||
| 33 | $options[] = $types[1]; |
||
| 34 | |||
| 35 | $options[] = 'single/' . $types[0] . '-' . $types[1]; |
||
| 36 | $options[] = $types[0] . '-' . $types[1]; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | $options[] = 'single/attachment'; |
||
| 41 | $options[] = 'attachment'; |
||
| 42 | break; |
||
| 43 | |||
| 44 | default: |
||
| 45 | $post = get_queried_object(); |
||
| 46 | if ( ! empty( $post->post_name ) ) { |
||
| 47 | $options[] = 'single/' . $post->post_name; |
||
| 48 | $options[] = $post->post_name; |
||
| 49 | } |
||
| 50 | |||
| 51 | $options[] = 'single/' . $post->ID; |
||
| 52 | $options[] = $post->ID; |
||
| 53 | |||
| 54 | $options[] = 'single/' . $post_type; |
||
| 55 | $options[] = $post_type; |
||
| 56 | break; |
||
| 57 | } |
||
| 58 | |||
| 59 | if ( 'page' !== $post_type ) { |
||
| 60 | $options[] = 'single'; |
||
| 61 | } |
||
| 62 | |||
| 63 | $this->set_options( $options ); |
||
| 64 | } |
||
| 65 | } |
||
| 66 |