@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | use Twig_Extension_StringLoader; |
| 7 | 7 | |
| 8 | 8 | if (!class_exists('Timber')) { |
| 9 | - add_action('admin_notices', function () { |
|
| 10 | - echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="' . esc_url(admin_url('plugins.php#timber')) . '">' . esc_url(admin_url('plugins.php')) . '</a></p></div>'; |
|
| 9 | + add_action('admin_notices', function() { |
|
| 10 | + echo '<div class="error"><p>Timber not activated. Make sure you activate the plugin in <a href="'.esc_url(admin_url('plugins.php#timber')).'">'.esc_url(admin_url('plugins.php')).'</a></p></div>'; |
|
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | 13 | return; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function registerPostTypes() |
| 49 | 49 | { |
| 50 | - foreach (glob(__DIR__ . "/inc/post-types/*.php") as $filename) { |
|
| 50 | + foreach (glob(__DIR__."/inc/post-types/*.php") as $filename) { |
|
| 51 | 51 | include_once $filename; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -115,30 +115,30 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | function themeAssets() |
| 117 | 117 | { |
| 118 | - $vendorJsExists = file_exists(get_template_directory() . '/dist/js/vendor.js'); |
|
| 119 | - $mainJsExists = file_exists(get_template_directory() . '/dist/js/main.js'); |
|
| 118 | + $vendorJsExists = file_exists(get_template_directory().'/dist/js/vendor.js'); |
|
| 119 | + $mainJsExists = file_exists(get_template_directory().'/dist/js/main.js'); |
|
| 120 | 120 | $mainJsDependencies = []; |
| 121 | 121 | |
| 122 | - $mainCssExists = file_exists(get_template_directory() . '/dist/css/main.css'); |
|
| 123 | - $vendorCssExists = file_exists(get_template_directory() . '/dist/css/vendor.css'); |
|
| 122 | + $mainCssExists = file_exists(get_template_directory().'/dist/css/main.css'); |
|
| 123 | + $vendorCssExists = file_exists(get_template_directory().'/dist/css/vendor.css'); |
|
| 124 | 124 | $mainCssDependencies = []; |
| 125 | 125 | |
| 126 | 126 | if ($vendorJsExists) { |
| 127 | - wp_enqueue_script('stashVendorJs', get_template_directory_uri() . '/dist/js/vendor.js', [], '1.0.0', true); |
|
| 127 | + wp_enqueue_script('stashVendorJs', get_template_directory_uri().'/dist/js/vendor.js', [], '1.0.0', true); |
|
| 128 | 128 | array_push($mainJsDependencies, 'stashVendorJs'); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if ($mainJsExists) { |
| 132 | - wp_enqueue_script('stashMainJs', get_template_directory_uri() . '/dist/js/main.js', $mainJsDependencies, '1.0.0', true); |
|
| 132 | + wp_enqueue_script('stashMainJs', get_template_directory_uri().'/dist/js/main.js', $mainJsDependencies, '1.0.0', true); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($vendorCssExists) { |
| 136 | - wp_enqueue_style('stashVendorCss', get_template_directory_uri() . '/dist/css/vendor.css', [], '1.0.0'); |
|
| 136 | + wp_enqueue_style('stashVendorCss', get_template_directory_uri().'/dist/css/vendor.css', [], '1.0.0'); |
|
| 137 | 137 | array_push($mainCssDependencies, 'stashVendorCss'); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if ($mainCssExists) { |
| 141 | - wp_enqueue_style('stashMainCss', get_template_directory_uri() . '/dist/css/main.css', $mainCssDependencies, '1.0.0'); |
|
| 141 | + wp_enqueue_style('stashMainCss', get_template_directory_uri().'/dist/css/main.css', $mainCssDependencies, '1.0.0'); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -14,27 +14,27 @@ |
||
| 14 | 14 | * @since Timber 0.2 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -$templates = array( 'archive.twig', 'index.twig' ); |
|
| 17 | +$templates = array('archive.twig', 'index.twig'); |
|
| 18 | 18 | |
| 19 | 19 | $data = Timber::get_context(); |
| 20 | 20 | |
| 21 | 21 | $data['title'] = 'Archive'; |
| 22 | -if ( is_day() ) { |
|
| 23 | - $data['title'] = 'Archive: '.get_the_date( 'D M Y' ); |
|
| 24 | -} else if ( is_month() ) { |
|
| 25 | - $data['title'] = 'Archive: '.get_the_date( 'M Y' ); |
|
| 26 | -} else if ( is_year() ) { |
|
| 27 | - $data['title'] = 'Archive: '.get_the_date( 'Y' ); |
|
| 28 | -} else if ( is_tag() ) { |
|
| 29 | - $data['title'] = single_tag_title( '', false ); |
|
| 30 | -} else if ( is_category() ) { |
|
| 31 | - $data['title'] = single_cat_title( '', false ); |
|
| 32 | - array_unshift( $templates, 'archive-' . get_query_var( 'cat' ) . '.twig' ); |
|
| 33 | -} else if ( is_post_type_archive() ) { |
|
| 34 | - $data['title'] = post_type_archive_title( '', false ); |
|
| 35 | - array_unshift( $templates, 'archive-' . get_post_type() . '.twig' ); |
|
| 22 | +if (is_day()) { |
|
| 23 | + $data['title'] = 'Archive: '.get_the_date('D M Y'); |
|
| 24 | +} else if (is_month()) { |
|
| 25 | + $data['title'] = 'Archive: '.get_the_date('M Y'); |
|
| 26 | +} else if (is_year()) { |
|
| 27 | + $data['title'] = 'Archive: '.get_the_date('Y'); |
|
| 28 | +} else if (is_tag()) { |
|
| 29 | + $data['title'] = single_tag_title('', false); |
|
| 30 | +} else if (is_category()) { |
|
| 31 | + $data['title'] = single_cat_title('', false); |
|
| 32 | + array_unshift($templates, 'archive-'.get_query_var('cat').'.twig'); |
|
| 33 | +} else if (is_post_type_archive()) { |
|
| 34 | + $data['title'] = post_type_archive_title('', false); |
|
| 35 | + array_unshift($templates, 'archive-'.get_post_type().'.twig'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $data['posts'] = Timber::get_posts(); |
| 39 | 39 | |
| 40 | -Timber::render( $templates, $data ); |
|
| 40 | +Timber::render($templates, $data); |
|
@@ -12,4 +12,4 @@ |
||
| 12 | 12 | $context = Timber::get_context(); |
| 13 | 13 | $post = new TimberPost(); |
| 14 | 14 | $context['post'] = $post; |
| 15 | -Timber::render(array('page-' . $post->post_name . '.twig', 'page.twig'), $context); |
|
| 16 | 15 | \ No newline at end of file |
| 16 | +Timber::render(array('page-'.$post->post_name.'.twig', 'page.twig'), $context); |
|
| 17 | 17 | \ No newline at end of file |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | $data = Timber::get_context(); |
| 14 | 14 | $data['posts'] = Timber::get_posts(); |
| 15 | -if ( isset( $wp_query->query_vars['author'] ) ) { |
|
| 16 | - $author = new TimberUser( $wp_query->query_vars['author'] ); |
|
| 15 | +if (isset($wp_query->query_vars['author'])) { |
|
| 16 | + $author = new TimberUser($wp_query->query_vars['author']); |
|
| 17 | 17 | $data['author'] = $author; |
| 18 | - $data['title'] = 'Author Archives: ' . $author->name(); |
|
| 18 | + $data['title'] = 'Author Archives: '.$author->name(); |
|
| 19 | 19 | } |
| 20 | -Timber::render( array( 'author.twig', 'archive.twig' ), $data ); |
|
| 20 | +Timber::render(array('author.twig', 'archive.twig'), $data); |
|
@@ -6,9 +6,9 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
| 8 | 8 | <header class="entry-header"> |
| 9 | - <?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> |
|
| 9 | + <?php the_title(sprintf('<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h1>'); ?> |
|
| 10 | 10 | |
| 11 | - <?php if ( 'post' == get_post_type() ) : ?> |
|
| 11 | + <?php if ('post' == get_post_type()) : ?> |
|
| 12 | 12 | <div class="entry-meta"> |
| 13 | 13 | <?php stash_posted_on(); ?> |
| 14 | 14 | </div><!-- .entry-meta --> |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | <div class="entry-content"> |
| 19 | 19 | <?php |
| 20 | 20 | /* translators: %s: Name of current post */ |
| 21 | - the_content( sprintf( |
|
| 22 | - __( 'Continue reading %s <span class="meta-nav">→</span>', 'stash' ), |
|
| 23 | - the_title( '<span class="screen-reader-text">"', '"</span>', false ) |
|
| 24 | - ) ); |
|
| 21 | + the_content(sprintf( |
|
| 22 | + __('Continue reading %s <span class="meta-nav">→</span>', 'stash'), |
|
| 23 | + the_title('<span class="screen-reader-text">"', '"</span>', false) |
|
| 24 | + )); |
|
| 25 | 25 | ?> |
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | - wp_link_pages( array( |
|
| 29 | - 'before' => '<div class="page-links">' . __( 'Pages:', 'stash' ), |
|
| 28 | + wp_link_pages(array( |
|
| 29 | + 'before' => '<div class="page-links">'.__('Pages:', 'stash'), |
|
| 30 | 30 | 'after' => '</div>', |
| 31 | - ) ); |
|
| 31 | + )); |
|
| 32 | 32 | ?> |
| 33 | 33 | </div><!-- .entry-content --> |
| 34 | 34 | |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | $context = Timber::get_context(); |
| 13 | 13 | $post = Timber::query_post(); |
| 14 | 14 | $context['post'] = $post; |
| 15 | -$context['wp_title'] .= ' - ' . $post->title(); |
|
| 15 | +$context['wp_title'] .= ' - '.$post->title(); |
|
| 16 | 16 | $context['comment_form'] = TimberHelper::get_comment_form(); |
| 17 | 17 | |
| 18 | -if ( post_password_required( $post->ID ) ) { |
|
| 19 | - Timber::render( 'single-password.twig', $context ); |
|
| 18 | +if (post_password_required($post->ID)) { |
|
| 19 | + Timber::render('single-password.twig', $context); |
|
| 20 | 20 | } else { |
| 21 | - Timber::render( array( 'single-' . $post->ID . '.twig', 'single-' . $post->post_type . '.twig', 'single.twig' ), $context ); |
|
| 21 | + Timber::render(array('single-'.$post->ID.'.twig', 'single-'.$post->post_type.'.twig', 'single.twig'), $context); |
|
| 22 | 22 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * the visitor has not yet entered the password we will |
| 14 | 14 | * return early without loading the comments. |
| 15 | 15 | */ |
| 16 | -if ( post_password_required() ) { |
|
| 16 | +if (post_password_required()) { |
|
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | ?> |
@@ -22,21 +22,21 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | <?php // You can start editing here -- including this comment! ?> |
| 24 | 24 | |
| 25 | - <?php if ( have_comments() ) : ?> |
|
| 25 | + <?php if (have_comments()) : ?> |
|
| 26 | 26 | <h2 class="comments-title"> |
| 27 | 27 | <?php |
| 28 | - printf( _nx( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'stash' ), |
|
| 29 | - number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' ); |
|
| 28 | + printf(_nx('One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'stash'), |
|
| 29 | + number_format_i18n(get_comments_number()), '<span>'.get_the_title().'</span>'); |
|
| 30 | 30 | ?> |
| 31 | 31 | </h2> |
| 32 | 32 | |
| 33 | - <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> |
|
| 33 | + <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?> |
|
| 34 | 34 | <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation"> |
| 35 | - <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'stash' ); ?></h2> |
|
| 35 | + <h2 class="screen-reader-text"><?php _e('Comment navigation', 'stash'); ?></h2> |
|
| 36 | 36 | <div class="nav-links"> |
| 37 | 37 | |
| 38 | - <div class="nav-previous"><?php previous_comments_link( __( 'Older Comments', 'stash' ) ); ?></div> |
|
| 39 | - <div class="nav-next"><?php next_comments_link( __( 'Newer Comments', 'stash' ) ); ?></div> |
|
| 38 | + <div class="nav-previous"><?php previous_comments_link(__('Older Comments', 'stash')); ?></div> |
|
| 39 | + <div class="nav-next"><?php next_comments_link(__('Newer Comments', 'stash')); ?></div> |
|
| 40 | 40 | |
| 41 | 41 | </div><!-- .nav-links --> |
| 42 | 42 | </nav><!-- #comment-nav-above --> |
@@ -44,20 +44,20 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <ol class="comment-list"> |
| 46 | 46 | <?php |
| 47 | - wp_list_comments( array( |
|
| 47 | + wp_list_comments(array( |
|
| 48 | 48 | 'style' => 'ol', |
| 49 | 49 | 'short_ping' => true, |
| 50 | - ) ); |
|
| 50 | + )); |
|
| 51 | 51 | ?> |
| 52 | 52 | </ol><!-- .comment-list --> |
| 53 | 53 | |
| 54 | - <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> |
|
| 54 | + <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?> |
|
| 55 | 55 | <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation"> |
| 56 | - <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'stash' ); ?></h2> |
|
| 56 | + <h2 class="screen-reader-text"><?php _e('Comment navigation', 'stash'); ?></h2> |
|
| 57 | 57 | <div class="nav-links"> |
| 58 | 58 | |
| 59 | - <div class="nav-previous"><?php previous_comments_link( __( 'Older Comments', 'stash' ) ); ?></div> |
|
| 60 | - <div class="nav-next"><?php next_comments_link( __( 'Newer Comments', 'stash' ) ); ?></div> |
|
| 59 | + <div class="nav-previous"><?php previous_comments_link(__('Older Comments', 'stash')); ?></div> |
|
| 60 | + <div class="nav-next"><?php next_comments_link(__('Newer Comments', 'stash')); ?></div> |
|
| 61 | 61 | |
| 62 | 62 | </div><!-- .nav-links --> |
| 63 | 63 | </nav><!-- #comment-nav-below --> |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | <?php |
| 69 | 69 | // If comments are closed and there are comments, let's leave a little note, shall we? |
| 70 | - if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : |
|
| 70 | + if (!comments_open() && '0' != get_comments_number() && post_type_supports(get_post_type(), 'comments')) : |
|
| 71 | 71 | ?> |
| 72 | - <p class="no-comments"><?php _e( 'Comments are closed.', 'stash' ); ?></p> |
|
| 72 | + <p class="no-comments"><?php _e('Comments are closed.', 'stash'); ?></p> |
|
| 73 | 73 | <?php endif; ?> |
| 74 | 74 | |
| 75 | 75 | <?php comment_form(); ?> |
@@ -54,9 +54,9 @@ |
||
| 54 | 54 | |
| 55 | 55 | foreach ($list_searcheable_acf as $searcheable_acf) : |
| 56 | 56 | if ($searcheable_acf == $list_searcheable_acf[0]): |
| 57 | - $where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
| 57 | + $where .= " (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
| 58 | 58 | else : |
| 59 | - $where .= " OR (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') "; |
|
| 59 | + $where .= " OR (meta_key LIKE '%".$searcheable_acf."%' AND meta_value LIKE '%$tag%') "; |
|
| 60 | 60 | endif; |
| 61 | 61 | endforeach; |
| 62 | 62 | |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | function get($name) |
| 13 | 13 | { |
| 14 | - return get_template_directory_uri() . '/dist/images/' . $name; |
|
| 14 | + return get_template_directory_uri().'/dist/images/'.$name; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | function display($name) |
| 18 | 18 | { |
| 19 | - return "<img src='" . $this->get($name) . "' />"; |
|
| 19 | + return "<img src='".$this->get($name)."' />"; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |