templates for self-hosting game jams (or any other kind of jam tbh)
at main 1.4 kB view raw
1<?php 2 3namespace App\View\Composers; 4 5use Roots\Acorn\View\Composer; 6 7class Post extends Composer 8{ 9 /** 10 * List of views served by this composer. 11 * 12 * @var array 13 */ 14 protected static $views = [ 15 'partials.page-header', 16 'partials.content', 17 'partials.content-*', 18 ]; 19 20 /** 21 * Retrieve the post title. 22 */ 23 public function title(): string 24 { 25 if ($this->view->name() !== 'partials.page-header') { 26 return get_the_title(); 27 } 28 29 if (is_home()) { 30 if ($home = get_option('page_for_posts', true)) { 31 return get_the_title($home); 32 } 33 34 return __('Latest Posts', 'sage'); 35 } 36 37 if (is_archive()) { 38 return get_the_archive_title(); 39 } 40 41 if (is_search()) { 42 return sprintf( 43 /* translators: %s is replaced with the search query */ 44 __('Search Results for %s', 'sage'), 45 get_search_query() 46 ); 47 } 48 49 if (is_404()) { 50 return __('Not Found', 'sage'); 51 } 52 53 return get_the_title(); 54 } 55 56 /** 57 * Retrieve the pagination links. 58 */ 59 public function pagination(): string 60 { 61 return wp_link_pages([ 62 'echo' => 0, 63 'before' => '<p>'.__('Pages:', 'sage'), 64 'after' => '</p>', 65 ]); 66 } 67}