├── .gitignore ├── README.md ├── composer.json ├── views ├── seperate-mustache-render-example.mustache ├── nav.mustache ├── page.mustache ├── footer.mustache ├── sidebar.mustache ├── index.mustache └── header.mustache ├── compiler.php ├── seperate-mustache-render-example.php ├── page.php ├── single.php ├── style.css ├── index.php ├── page-data.php └── functions.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | .DS_Store 3 | composer.lock 4 | composer.phar 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wordpress-starter-theme-mustache 2 | {{mustache}} starter theme for Wordpress 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "mustache/mustache": "~2.5" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /views/seperate-mustache-render-example.mustache: -------------------------------------------------------------------------------- 1 |

Seperate mustache render

2 | {{message}} 3 | -------------------------------------------------------------------------------- /views/nav.mustache: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /views/page.mustache: -------------------------------------------------------------------------------- 1 | {{> header}} 2 | 3 | {{#page}} 4 |

{{{title}}}

5 | {{{content}}} 6 | {{/page}} 7 | 8 | {{> footer}} 9 | -------------------------------------------------------------------------------- /views/footer.mustache: -------------------------------------------------------------------------------- 1 | {{>sidebar}} 2 | 3 | {{{seperate_mustache_render_example}}} 4 | 5 | {{{wp_footer}}} 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /views/sidebar.mustache: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /compiler.php: -------------------------------------------------------------------------------- 1 | new Mustache_Loader_FilesystemLoader(get_template_directory() . '/views') 7 | )); 8 | 9 | ?> 10 | -------------------------------------------------------------------------------- /seperate-mustache-render-example.php: -------------------------------------------------------------------------------- 1 | 'This is a seperate mustache render being included using {{{seperate_mustache_render_example}}}' 5 | ); 6 | 7 | return $compiler->render('seperate-mustache-render-example', $data); 8 | 9 | ?> 10 | -------------------------------------------------------------------------------- /views/index.mustache: -------------------------------------------------------------------------------- 1 | {{> header}} 2 | 3 | {{#posts}} 4 |

{{{title}}}

5 | {{{excerpt}}} 6 | {{/posts}} 7 | 8 | 12 | 13 | {{> footer}} 14 | -------------------------------------------------------------------------------- /page.php: -------------------------------------------------------------------------------- 1 | get_permalink(), 10 | 'title' => get_the_title(), 11 | 'content' => get_the_content() 12 | ); 13 | 14 | endwhile; endif; 15 | 16 | echo $compiler->render('page', $data); 17 | 18 | ?> 19 | -------------------------------------------------------------------------------- /single.php: -------------------------------------------------------------------------------- 1 | get_permalink(), 10 | 'title' => get_the_title(), 11 | 'content' => get_the_content() 12 | ); 13 | 14 | endwhile; endif; 15 | 16 | echo $compiler->render('page', $data); 17 | 18 | ?> 19 | -------------------------------------------------------------------------------- /views/header.mustache: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{wp_title}} 6 | 7 | {{{wp_head}}} 8 | {{#template}}{{/template}} 9 | 10 | 11 | 12 |
13 | {{blog_title}} 14 | {{> nav}} 15 |
16 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name: cjonasw-MustachePHP-Example 3 | Theme URI: https://github.com/cjonasw/ 4 | Description: cjonasw-MustachePHP-Example 5 | Version: 1 6 | Author: Charlie Walter 7 | Author URI: http://www.charliejwalter.net 8 | */ 9 | 10 | body{ 11 | background: whitesmoke; 12 | color: grey; 13 | } 14 | 15 | body:after{ 16 | content: "{{mustache}}"; 17 | } 18 | 19 | a{ 20 | color: grey; 21 | } 22 | 23 | .pagination{ 24 | margin-top: 1em; 25 | } 26 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | get_permalink(), 14 | 'title' => get_the_title(), 15 | 'excerpt' => get_the_excerpt() 16 | )); 17 | 18 | endwhile; 19 | 20 | $data['next_posts_link'] = get_next_posts_link('Older'); 21 | $data['previous_posts_link'] = get_previous_posts_link('Newer'); 22 | 23 | endif; 24 | 25 | echo $compiler->render('index', $data); 26 | 27 | ?> 28 | -------------------------------------------------------------------------------- /page-data.php: -------------------------------------------------------------------------------- 1 | wp_title('', false), 5 | 'wp_head' => output_buffer_contents(wp_head), 6 | 'wp_footer' => output_buffer_contents(wp_footer), 7 | 8 | 'template_directory_uri' => get_template_directory_uri(), 9 | 'stylesheet_url' => get_bloginfo('stylesheet_url'), 10 | 'home_url' => esc_url( home_url( '/' ) ), 11 | 'blog_title' => get_bloginfo(), 12 | 13 | 'pages' => get_pages(), 14 | 'categories' => get_categories('show_count=0&title_li=&hide_empty=0&exclude=1'), 15 | 16 | 'seperate_mustache_render_example' => include 'seperate-mustache-render-example.php' 17 | ); 18 | 19 | // To compensate for Wordpress not providing a url for each post 20 | foreach ( $data['pages'] as $page ) { 21 | $page->permalink = get_permalink($page->ID); 22 | } 23 | 24 | // To compensate for Wordpress not providing a url for each category 25 | foreach ( $data['categories'] as $category ) { 26 | $category->link = get_category_link( $category->term_id ); 27 | } 28 | 29 | return $data; 30 | 31 | ?> 32 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | $page->post_title, 28 | // 'link' => get_permalink( $page->ID ) 29 | // ) 30 | // ); 31 | // } 32 | // 33 | // return $pages; 34 | // } 35 | // 36 | // function getCategories() { 37 | // 38 | // $categories = array(); 39 | // 40 | // foreach (get_categories('show_count=0&title_li=&hide_empty=0&exclude=1') as $category) { 41 | // 42 | // $category->link = get_category_link( $category->term_id ); 43 | // 44 | // array_push($categories, $category); 45 | // }; 46 | // 47 | // return $categories; 48 | // 49 | // } 50 | 51 | ?> 52 | --------------------------------------------------------------------------------