| @@ 68-84 (lines=17) @@ | ||
| 65 | * |
|
| 66 | * If none controller is found, fallback on teh default post |
|
| 67 | */ |
|
| 68 | public function single() |
|
| 69 | { |
|
| 70 | $this->setContext(); |
|
| 71 | ||
| 72 | $context = $this->context; |
|
| 73 | ||
| 74 | $file = get_template_directory() . '/controllers/single/' . $this->context['post']->post_type . '.php'; |
|
| 75 | ||
| 76 | if (file_exists($file)) { |
|
| 77 | /** |
|
| 78 | * Set context for included file |
|
| 79 | */ |
|
| 80 | include($file); |
|
| 81 | } else { |
|
| 82 | Timber::render(array('single-' . $context['post']->ID . '.twig', 'single-' . $context['post']->post_type . '.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | public function fourOFour() |
|
| 87 | { |
|
| @@ 91-107 (lines=17) @@ | ||
| 88 | include(get_template_directory() . '/controllers/404.php'); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function archive() |
|
| 92 | { |
|
| 93 | $this->setContext(); |
|
| 94 | ||
| 95 | $context = $this->context; |
|
| 96 | ||
| 97 | $file = get_template_directory() . '/controllers/archive/' . $this->context['post']->post_type . '.php'; |
|
| 98 | ||
| 99 | if (file_exists($file)) { |
|
| 100 | /** |
|
| 101 | * Set context for included file |
|
| 102 | */ |
|
| 103 | include($file); |
|
| 104 | } else { |
|
| 105 | Timber::render(array('single-' . $context['post']->ID . '.twig', 'single-' . $context['post']->post_type . '.twig', 'single.twig'), $context, Cache::getTimerTime()); |
|
| 106 | } |
|
| 107 | } |
|
| 108 | ||
| 109 | public function page() |
|
| 110 | { |
|