@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Set the content width based on the theme's design and stylesheet. |
12 | -if ( ! isset( $content_width ) ) { |
|
12 | +if ( ! isset($content_width)) { |
|
13 | 13 | $content_width = 1920; |
14 | 14 | } /* pixels */ |
15 | 15 | |
16 | -if ( ! function_exists( 'strip_setup' ) ) : |
|
16 | +if ( ! function_exists('strip_setup')) : |
|
17 | 17 | /** |
18 | 18 | * Sets up theme defaults and registers support for various WordPress features. |
19 | 19 | * |
@@ -28,29 +28,29 @@ discard block |
||
28 | 28 | * adding custom login css |
29 | 29 | * changing text in footer of admin |
30 | 30 | */ |
31 | - require_once( 'assets/admin.php' ); |
|
31 | + require_once('assets/admin.php'); |
|
32 | 32 | /** |
33 | 33 | * Make theme available for translation |
34 | 34 | * Translations can be filed in the /languages/ directory |
35 | 35 | * If you're building a theme based on strip, use a find and replace |
36 | 36 | * to change 'strip' to the name of your theme in all the template files |
37 | 37 | */ |
38 | - load_theme_textdomain( 'strip', get_template_directory() . '/languages' ); |
|
38 | + load_theme_textdomain('strip', get_template_directory() . '/languages'); |
|
39 | 39 | |
40 | 40 | // Add default posts and comments RSS feed links to head. |
41 | - add_theme_support( 'automatic-feed-links' ); |
|
41 | + add_theme_support('automatic-feed-links'); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Enable support for title-tag. Allows themes to add document title tag to HTML <head> (since version 4.1.). |
45 | 45 | */ |
46 | - add_theme_support( 'title-tag' ); |
|
46 | + add_theme_support('title-tag'); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Enable support for custom logo. |
50 | 50 | * |
51 | 51 | * @since strip 1.0 |
52 | 52 | */ |
53 | - add_theme_support( 'custom-logo', array( |
|
53 | + add_theme_support('custom-logo', array( |
|
54 | 54 | 'height' => 156, |
55 | 55 | 'width' => 312, |
56 | 56 | 'flex-height' => true, |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ |
65 | 65 | */ |
66 | - add_theme_support( 'post-thumbnails' ); |
|
67 | - add_image_size( 'strip-featured-image', 1920, 960, true ); |
|
68 | - add_image_size( 'strip-large', 1920, 960, true ); // cropped. |
|
69 | - add_image_size( 'strip-medium', 624, 312, true ); // cropped. |
|
70 | - add_image_size( 'strip-thumbnail', 312, 156, true ); // cropped. |
|
66 | + add_theme_support('post-thumbnails'); |
|
67 | + add_image_size('strip-featured-image', 1920, 960, true); |
|
68 | + add_image_size('strip-large', 1920, 960, true); // cropped. |
|
69 | + add_image_size('strip-medium', 624, 312, true); // cropped. |
|
70 | + add_image_size('strip-thumbnail', 312, 156, true); // cropped. |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Remove paragraph tags around images. |
@@ -77,36 +77,36 @@ discard block |
||
77 | 77 | * @link https://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/ |
78 | 78 | * @see http://codex.wordpress.org/Function_Reference/wpautop gets the same result but removes line blocks: remove_filter( 'the_content', 'wpautop' ); |
79 | 79 | */ |
80 | - function filter_ptags_on_images( $picture ) { |
|
81 | - $picture = preg_replace( '/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $picture ); |
|
82 | - return preg_replace( '/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $picture ); |
|
80 | + function filter_ptags_on_images($picture) { |
|
81 | + $picture = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $picture); |
|
82 | + return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $picture); |
|
83 | 83 | } |
84 | - add_filter( 'the_content', 'filter_ptags_on_images' ); |
|
84 | + add_filter('the_content', 'filter_ptags_on_images'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * This theme uses wp_nav_menu() in one location. |
88 | 88 | */ |
89 | 89 | register_nav_menus(array( |
90 | - 'primary' => __( 'Primary Menu', 'strip' ), |
|
90 | + 'primary' => __('Primary Menu', 'strip'), |
|
91 | 91 | )); |
92 | 92 | |
93 | 93 | /* |
94 | 94 | * Switch default core markup for search form, comment form, and comments |
95 | 95 | * to output valid HTML5. |
96 | 96 | */ |
97 | - add_theme_support( 'html5', array( |
|
97 | + add_theme_support('html5', array( |
|
98 | 98 | 'search-form', |
99 | 99 | 'comment-form', |
100 | 100 | 'comment-list', |
101 | 101 | 'gallery', |
102 | 102 | 'caption', |
103 | 103 | 'widgets', |
104 | - ) ); |
|
104 | + )); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Enable support for Post Formats |
108 | 108 | */ |
109 | - add_theme_support( 'post-formats', array( |
|
109 | + add_theme_support('post-formats', array( |
|
110 | 110 | 'image', |
111 | 111 | 'video', |
112 | 112 | 'quote', |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | 'gallery', |
115 | 115 | 'audio', |
116 | 116 | 'chat', |
117 | - ) ); |
|
117 | + )); |
|
118 | 118 | |
119 | 119 | // Setup the WordPress core custom background feature. |
120 | 120 | add_theme_support('custom-background', apply_filters('strip_custom_background_args', array( |
121 | 121 | 'default-color' => 'ffffff', |
122 | 122 | 'default-image' => '', |
123 | - ) ) ); |
|
123 | + ))); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * This theme styles the visual editor to resemble the theme style, |
128 | 128 | * specifically font, colors, icons, and column width. |
129 | 129 | */ |
130 | - add_editor_style( array( '/assets/css/editor-style.css', '/assets/fonts/fenix.css' ) ); |
|
130 | + add_editor_style(array('/assets/css/editor-style.css', '/assets/fonts/fenix.css')); |
|
131 | 131 | |
132 | 132 | // Indicate widget sidebars can use selective refresh in the Customizer. |
133 | 133 | // See https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/ for detail. |
134 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
134 | + add_theme_support('customize-selective-refresh-widgets'); |
|
135 | 135 | endif; // strip_setup. |
136 | -add_action( 'after_setup_theme', 'strip_setup' ); |
|
136 | +add_action('after_setup_theme', 'strip_setup'); |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Register widgetized area and update sidebar with default widgets |
140 | 140 | */ |
141 | 141 | function strip_widgets_init() { |
142 | 142 | register_sidebar(array( |
143 | - 'name' => __( 'Main Sidebar', 'strip' ), |
|
143 | + 'name' => __('Main Sidebar', 'strip'), |
|
144 | 144 | 'id' => 'sidebar', |
145 | - 'description' => __( 'The main body widget area', 'strip' ), |
|
145 | + 'description' => __('The main body widget area', 'strip'), |
|
146 | 146 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
147 | 147 | 'after_widget' => '</aside>', |
148 | 148 | 'before_title' => '<h2 class="widget-title">', |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | )); |
151 | 151 | |
152 | 152 | // First footer widget area, located in the footer. Empty by default. |
153 | - register_sidebar( array( |
|
154 | - 'name' => __( 'First Footer Widget', 'strip' ), |
|
153 | + register_sidebar(array( |
|
154 | + 'name' => __('First Footer Widget', 'strip'), |
|
155 | 155 | 'id' => 'first-footer-widget', |
156 | - 'description' => __( 'The first footer widget', 'strip' ), |
|
156 | + 'description' => __('The first footer widget', 'strip'), |
|
157 | 157 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
158 | 158 | 'after_widget' => '</aside>', |
159 | 159 | 'before_title' => '<h3 class="widget-title">', |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | |
163 | 163 | // Second Footer Widget Area, located in the footer. Empty by default. |
164 | 164 | register_sidebar(array( |
165 | - 'name' => __( 'Second Footer Widget', 'strip' ), |
|
165 | + 'name' => __('Second Footer Widget', 'strip'), |
|
166 | 166 | 'id' => 'second-footer-widget', |
167 | - 'description' => __( 'The second footer widget', 'strip' ), |
|
167 | + 'description' => __('The second footer widget', 'strip'), |
|
168 | 168 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
169 | 169 | 'after_widget' => '</aside>', |
170 | 170 | 'before_title' => '<h3 class="widget-title">', |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | |
174 | 174 | // Third Footer Widget Area, located in the footer. Empty by default. |
175 | 175 | register_sidebar(array( |
176 | - 'name' => __( 'Third Footer Widget', 'strip' ), |
|
176 | + 'name' => __('Third Footer Widget', 'strip'), |
|
177 | 177 | 'id' => 'third-footer-widget', |
178 | - 'description' => __( 'The third footer widget', 'strip' ), |
|
178 | + 'description' => __('The third footer widget', 'strip'), |
|
179 | 179 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
180 | 180 | 'after_widget' => '</aside>', |
181 | 181 | 'before_title' => '<h3 class="widget-title">', |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | |
185 | 185 | // Fourth Footer Widget Area, located in the footer. Empty by default. |
186 | 186 | register_sidebar(array( |
187 | - 'name' => __( 'Fourth Footer Widget', 'strip' ), |
|
187 | + 'name' => __('Fourth Footer Widget', 'strip'), |
|
188 | 188 | 'id' => 'fourth-footer-widget', |
189 | - 'description' => __( 'The fourth footer widget', 'strip' ), |
|
189 | + 'description' => __('The fourth footer widget', 'strip'), |
|
190 | 190 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
191 | 191 | 'after_widget' => '</aside>', |
192 | 192 | 'before_title' => '<h3 class="widget-title">', |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | )); |
195 | 195 | |
196 | 196 | } |
197 | -add_action( 'widgets_init', 'strip_widgets_init' ); |
|
197 | +add_action('widgets_init', 'strip_widgets_init'); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Handles JavaScript detection. |
@@ -206,47 +206,47 @@ discard block |
||
206 | 206 | function strip_javascript_detection() { |
207 | 207 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
208 | 208 | } |
209 | -add_action( 'wp_head', 'strip_javascript_detection', 0 ); |
|
209 | +add_action('wp_head', 'strip_javascript_detection', 0); |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Enqueue_styles for custom fonts. |
213 | 213 | */ |
214 | 214 | function strip_scripts() { |
215 | 215 | // add custom font here if any. |
216 | - wp_enqueue_style( 'fenix', get_template_directory_uri() . '/assets/fonts/fenix.css', array(), null ); |
|
216 | + wp_enqueue_style('fenix', get_template_directory_uri() . '/assets/fonts/fenix.css', array(), null); |
|
217 | 217 | |
218 | - wp_enqueue_style( 'inconsolata', get_template_directory_uri() . '/assets/fonts/inconsolata.css', array(), null ); |
|
218 | + wp_enqueue_style('inconsolata', get_template_directory_uri() . '/assets/fonts/inconsolata.css', array(), null); |
|
219 | 219 | |
220 | 220 | // Theme stylesheet. |
221 | - wp_enqueue_style( 'strip-style', get_stylesheet_uri() ); |
|
221 | + wp_enqueue_style('strip-style', get_stylesheet_uri()); |
|
222 | 222 | |
223 | 223 | // Load the Internet Explorer specific stylesheet. Conditional stylesheet — tested and works with IE9 on Windows7. |
224 | - wp_enqueue_style( 'strip-ie', get_template_directory_uri() . 'assets/css/ie.css', array( 'strip-style' ), '20160305' ); |
|
225 | - wp_style_add_data( 'strip-ie', 'conditional', 'lt IE 10' ); |
|
224 | + wp_enqueue_style('strip-ie', get_template_directory_uri() . 'assets/css/ie.css', array('strip-style'), '20160305'); |
|
225 | + wp_style_add_data('strip-ie', 'conditional', 'lt IE 10'); |
|
226 | 226 | |
227 | - if ( has_nav_menu( 'primary' ) ) { |
|
228 | - wp_enqueue_script( 'strip-navigation', get_template_directory_uri() . '/assets/js/min/navigation-min.js', array(), '1.0', true ); |
|
227 | + if (has_nav_menu('primary')) { |
|
228 | + wp_enqueue_script('strip-navigation', get_template_directory_uri() . '/assets/js/min/navigation-min.js', array(), '1.0', true); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Load the html5 shiv. |
232 | - wp_enqueue_script( 'strip-html5', get_template_directory_uri() . '/assets/js/min/html5-min.js', array(), '3.7.3' ); |
|
233 | - wp_script_add_data( 'strip-html5', 'conditional', 'lt IE 9' ); |
|
232 | + wp_enqueue_script('strip-html5', get_template_directory_uri() . '/assets/js/min/html5-min.js', array(), '3.7.3'); |
|
233 | + wp_script_add_data('strip-html5', 'conditional', 'lt IE 9'); |
|
234 | 234 | |
235 | - wp_enqueue_script( 'strip-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/min/skip-link-focus-fix-min.js', array(), '1.0', true ); |
|
235 | + wp_enqueue_script('strip-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/min/skip-link-focus-fix-min.js', array(), '1.0', true); |
|
236 | 236 | |
237 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
238 | - wp_enqueue_script( 'comment-reply' ); |
|
237 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
238 | + wp_enqueue_script('comment-reply'); |
|
239 | 239 | |
240 | 240 | // toggle comments js. |
241 | - wp_enqueue_script( 'strip-toggle-comments', get_template_directory_uri() . '/assets/js/min/toggle-comments-min.js', array( 'jquery' ), '1.2', true ); |
|
241 | + wp_enqueue_script('strip-toggle-comments', get_template_directory_uri() . '/assets/js/min/toggle-comments-min.js', array('jquery'), '1.2', true); |
|
242 | 242 | |
243 | - if ( is_single() && wp_attachment_is_image() ) { |
|
244 | - wp_enqueue_script( 'strip-keyboard-image-navigation', get_template_directory_uri() . '/assets/js/min/keyboard-image-navigation-min.js', array( 'jquery' ), '20160412', true ); |
|
243 | + if (is_single() && wp_attachment_is_image()) { |
|
244 | + wp_enqueue_script('strip-keyboard-image-navigation', get_template_directory_uri() . '/assets/js/min/keyboard-image-navigation-min.js', array('jquery'), '20160412', true); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | -add_action( 'wp_enqueue_scripts', 'strip_scripts' ); |
|
249 | +add_action('wp_enqueue_scripts', 'strip_scripts'); |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Implement the Custom Header feature. |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | */ |
274 | 274 | require get_template_directory() . '/inc/jetpack.php'; |
275 | 275 | |
276 | -add_action( 'wp_enqueue_scripts', 'enqueue_royal_sliders' ); |
|
276 | +add_action('wp_enqueue_scripts', 'enqueue_royal_sliders'); |
|
277 | 277 | /** |
278 | 278 | * Register RoyalSLider |
279 | 279 | */ |
280 | 280 | function enqueue_royal_sliders() { |
281 | - if ( function_exists( 'register_new_royalslider_files' ) ) { |
|
281 | + if (function_exists('register_new_royalslider_files')) { |
|
282 | 282 | // you could try this: if ( is_single() && is_archive() ) { but you don't really need it. |
283 | - register_new_royalslider_files( 1 ); // 1 is RoyalSlider configuration number |
|
283 | + register_new_royalslider_files(1); // 1 is RoyalSlider configuration number |
|
284 | 284 | // add } if use is_single etc. |
285 | 285 | } |
286 | 286 | } |
@@ -293,24 +293,24 @@ discard block |
||
293 | 293 | * @link https://gist.github.com/SilentComics/0a7ea47942eb759dbb48eac2b7be1bbc/ |
294 | 294 | */ |
295 | 295 | function get_first_image() { |
296 | - $post = get_post(); |
|
296 | + $post = get_post(); |
|
297 | 297 | $first_img = ''; |
298 | - preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', do_shortcode( $post->post_content, 'gallery' ), $matches ); |
|
299 | - $first_img = isset( $matches[1][0] ) ? $matches[1][0] : null; |
|
298 | + preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', do_shortcode($post->post_content, 'gallery'), $matches); |
|
299 | + $first_img = isset($matches[1][0]) ? $matches[1][0] : null; |
|
300 | 300 | |
301 | - if ( empty( $first_img ) ) { |
|
301 | + if (empty($first_img)) { |
|
302 | 302 | return get_template_directory_uri() . '/assets/images/empty.png'; // path to default image. |
303 | 303 | } |
304 | 304 | |
305 | 305 | // Now we have the $first_img but we want the thumbnail of that image. |
306 | - $explode = explode( '.', $first_img ); |
|
307 | - $count = count( $explode ); |
|
306 | + $explode = explode('.', $first_img); |
|
307 | + $count = count($explode); |
|
308 | 308 | $size = '-624x312'; // Panel ratio (2:1) 312x156 for lighther page, 624x312 for retina; use add_image_size() and Force Regenerate Thumbnails plugin when changing sizes. |
309 | - $explode[ $count -2 ] = $explode[ $count -2 ] . '' . $size; |
|
310 | - $thumb_img = implode( '.', $explode ); |
|
309 | + $explode[$count - 2] = $explode[$count - 2] . '' . $size; |
|
310 | + $thumb_img = implode('.', $explode); |
|
311 | 311 | return $thumb_img; |
312 | 312 | } |
313 | - add_filter( 'get_first_image', 'thumbnail' ); |
|
313 | + add_filter('get_first_image', 'thumbnail'); |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Register Custom Post Type for comics |
@@ -318,24 +318,24 @@ discard block |
||
318 | 318 | function comic_post_type() { |
319 | 319 | |
320 | 320 | $labels = array( |
321 | - 'name' => _x( 'Comics', 'Post Type General Name', 'strip' ), |
|
322 | - 'singular_name' => _x( 'Comic', 'Post Type Singular Name', 'strip' ), |
|
323 | - 'menu_name' => _x( 'Comics', 'admin menu', 'strip' ), |
|
324 | - 'name_admin_bar' => _x( 'Comic', 'add new on admin bar', 'strip' ), |
|
325 | - 'parent_item_colon' => __( 'Parent Comic:', 'strip' ), |
|
326 | - 'all_items' => __( 'All Comics', 'strip' ), |
|
327 | - 'add_new_item' => __( 'Add New Comic', 'strip' ), |
|
328 | - 'add_new' => __( 'Add New Comic', 'strip' ), |
|
329 | - 'new_item' => __( 'New Comic', 'strip' ), |
|
330 | - 'edit_item' => __( 'Edit Comic', 'strip' ), |
|
331 | - 'update_item' => __( 'Update Comic', 'strip' ), |
|
332 | - 'view_item' => __( 'View Comic', 'strip' ), |
|
333 | - 'search_items' => __( 'Search Item', 'strip' ), |
|
334 | - 'not_found' => __( 'No Comics found', 'strip' ), |
|
335 | - 'not_found_in_trash' => __( 'No Comics found in Trash', 'strip' ), |
|
336 | - 'items_list' => __( 'Comics list', 'strip' ), |
|
337 | - 'items_list_navigation' => __( 'Comics list navigation', 'strip' ), |
|
338 | - 'filter_items_list' => __( 'Filter Comics list', 'strip' ), |
|
321 | + 'name' => _x('Comics', 'Post Type General Name', 'strip'), |
|
322 | + 'singular_name' => _x('Comic', 'Post Type Singular Name', 'strip'), |
|
323 | + 'menu_name' => _x('Comics', 'admin menu', 'strip'), |
|
324 | + 'name_admin_bar' => _x('Comic', 'add new on admin bar', 'strip'), |
|
325 | + 'parent_item_colon' => __('Parent Comic:', 'strip'), |
|
326 | + 'all_items' => __('All Comics', 'strip'), |
|
327 | + 'add_new_item' => __('Add New Comic', 'strip'), |
|
328 | + 'add_new' => __('Add New Comic', 'strip'), |
|
329 | + 'new_item' => __('New Comic', 'strip'), |
|
330 | + 'edit_item' => __('Edit Comic', 'strip'), |
|
331 | + 'update_item' => __('Update Comic', 'strip'), |
|
332 | + 'view_item' => __('View Comic', 'strip'), |
|
333 | + 'search_items' => __('Search Item', 'strip'), |
|
334 | + 'not_found' => __('No Comics found', 'strip'), |
|
335 | + 'not_found_in_trash' => __('No Comics found in Trash', 'strip'), |
|
336 | + 'items_list' => __('Comics list', 'strip'), |
|
337 | + 'items_list_navigation' => __('Comics list navigation', 'strip'), |
|
338 | + 'filter_items_list' => __('Filter Comics list', 'strip'), |
|
339 | 339 | ); |
340 | 340 | |
341 | 341 | $supports = array( |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | ); |
353 | 353 | |
354 | 354 | $args = array( |
355 | - 'label' => __( 'Comic', 'strip' ), |
|
356 | - 'description' => __( 'Publish Comics and Webcomics', 'strip' ), |
|
355 | + 'label' => __('Comic', 'strip'), |
|
356 | + 'description' => __('Publish Comics and Webcomics', 'strip'), |
|
357 | 357 | 'labels' => $labels, |
358 | 358 | 'supports' => $supports, |
359 | - 'taxonomies' => array( 'story', 'story_term', 'draft' ), |
|
359 | + 'taxonomies' => array('story', 'story_term', 'draft'), |
|
360 | 360 | 'hierarchical' => true, |
361 | 361 | 'public' => true, |
362 | 362 | 'show_ui' => true, |
@@ -369,40 +369,40 @@ discard block |
||
369 | 369 | 'has_archive' => true, |
370 | 370 | 'feeds' => true, |
371 | 371 | 'exclude_from_search' => false, |
372 | - 'rewrite' => array( 'slug' => 'stories', 'with_front' => true ), |
|
372 | + 'rewrite' => array('slug' => 'stories', 'with_front' => true), |
|
373 | 373 | 'publicly_queryable' => true, |
374 | 374 | 'capability_type' => 'post', |
375 | 375 | ); |
376 | - register_post_type( 'comic', $args ); |
|
376 | + register_post_type('comic', $args); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // Hook into the 'init' action. |
380 | -add_action( 'init', 'comic_post_type', 0 ); // End of register_cpt_comic(). |
|
380 | +add_action('init', 'comic_post_type', 0); // End of register_cpt_comic(). |
|
381 | 381 | |
382 | 382 | /** |
383 | 383 | * Register Custom Taxonomy 'story' |
384 | 384 | */ |
385 | 385 | function comic_story_taxonomy() { |
386 | 386 | $labels = array( |
387 | - 'name' => _x( 'Comic Story', 'Taxonomy General Name', 'strip' ), |
|
388 | - 'singular_name' => _x( 'Comic Story', 'Taxonomy Singular Name', 'strip' ), |
|
389 | - 'menu_name' => __( 'Comic Stories', 'strip' ), |
|
390 | - 'all_items' => __( 'All Comic Stories', 'strip' ), |
|
391 | - 'parent_item' => __( 'Parent Story', 'strip' ), |
|
392 | - 'parent_item_colon' => __( 'Parent Story:', 'strip' ), |
|
393 | - 'new_item_name' => __( 'New Comic Story', 'strip' ), |
|
394 | - 'add_new_item' => __( 'Add New Story', 'strip' ), |
|
395 | - 'edit_item' => __( 'Edit Story', 'strip' ), |
|
396 | - 'update_item' => __( 'Update Story', 'strip' ), |
|
397 | - 'view_item' => __( 'View Item', 'strip' ), |
|
398 | - 'separate_items_with_commas' => __( 'Separate stories with commas', 'strip' ), |
|
399 | - 'add_or_remove_items' => __( 'Add or Remove Stories', 'strip' ), |
|
400 | - 'choose_from_most_used' => __( 'Choose from the most used stories', 'strip' ), |
|
401 | - 'popular_items' => __( 'Popular comic stories', 'strip' ), |
|
402 | - 'search_items' => __( 'Search Stories', 'strip' ), |
|
403 | - 'not_found' => __( 'No comic Stories found', 'strip' ), |
|
404 | - 'items_list' => __( 'Comic Stories list', 'strip' ), |
|
405 | - 'items_list_navigation' => __( 'Comic Stories list navigation', 'strip' ), |
|
387 | + 'name' => _x('Comic Story', 'Taxonomy General Name', 'strip'), |
|
388 | + 'singular_name' => _x('Comic Story', 'Taxonomy Singular Name', 'strip'), |
|
389 | + 'menu_name' => __('Comic Stories', 'strip'), |
|
390 | + 'all_items' => __('All Comic Stories', 'strip'), |
|
391 | + 'parent_item' => __('Parent Story', 'strip'), |
|
392 | + 'parent_item_colon' => __('Parent Story:', 'strip'), |
|
393 | + 'new_item_name' => __('New Comic Story', 'strip'), |
|
394 | + 'add_new_item' => __('Add New Story', 'strip'), |
|
395 | + 'edit_item' => __('Edit Story', 'strip'), |
|
396 | + 'update_item' => __('Update Story', 'strip'), |
|
397 | + 'view_item' => __('View Item', 'strip'), |
|
398 | + 'separate_items_with_commas' => __('Separate stories with commas', 'strip'), |
|
399 | + 'add_or_remove_items' => __('Add or Remove Stories', 'strip'), |
|
400 | + 'choose_from_most_used' => __('Choose from the most used stories', 'strip'), |
|
401 | + 'popular_items' => __('Popular comic stories', 'strip'), |
|
402 | + 'search_items' => __('Search Stories', 'strip'), |
|
403 | + 'not_found' => __('No comic Stories found', 'strip'), |
|
404 | + 'items_list' => __('Comic Stories list', 'strip'), |
|
405 | + 'items_list_navigation' => __('Comic Stories list navigation', 'strip'), |
|
406 | 406 | ); |
407 | 407 | $args = array( |
408 | 408 | 'labels' => $labels, |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | 'show_in_nav_menus' => true, |
415 | 415 | 'show_tagcloud' => true, |
416 | 416 | 'query_var' => true, |
417 | - 'rewrite' => array( 'slug' => 'story' ), |
|
417 | + 'rewrite' => array('slug' => 'story'), |
|
418 | 418 | ); |
419 | - register_taxonomy( 'story', array( 'comic' ), $args ); |
|
420 | - register_taxonomy_for_object_type( 'story', 'comic' ); |
|
419 | + register_taxonomy('story', array('comic'), $args); |
|
420 | + register_taxonomy_for_object_type('story', 'comic'); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | // Hook into the 'init' action. |
424 | -add_action( 'init', 'comic_story_taxonomy', 0 ); |
|
424 | +add_action('init', 'comic_story_taxonomy', 0); |
|
425 | 425 | |
426 | 426 | /** |
427 | 427 | * Function strip rewrite rules. |
@@ -430,31 +430,31 @@ discard block |
||
430 | 430 | flush_rewrite_rules(); |
431 | 431 | } |
432 | 432 | /* Flush rewrite rules for custom post types. */ |
433 | -add_action( 'after_switch_theme', 'strip_rewrite_rules' ); |
|
433 | +add_action('after_switch_theme', 'strip_rewrite_rules'); |
|
434 | 434 | |
435 | 435 | // Add Print taxonomy, NOT hierarchical (like tags) |
436 | 436 | // Register Custom Taxonomy. |
437 | 437 | $labels = array( |
438 | - 'name' => _x( 'Prints', 'Taxonomy General Name', 'strip' ), |
|
439 | - 'singular_name' => _x( 'Print', 'Taxonomy Singular Name', 'strip' ), |
|
440 | - 'menu_name' => __( 'Print', 'strip' ), |
|
441 | - 'all_items' => __( 'All Prints', 'strip' ), |
|
442 | - 'parent_item' => __( 'Parent Print', 'strip' ), |
|
443 | - 'parent_item_colon' => __( 'Parent Print:', 'strip' ), |
|
444 | - 'new_item_name' => __( 'New Print Name', 'strip' ), |
|
445 | - 'add_new_item' => __( 'Add New Print', 'strip' ), |
|
446 | - 'edit_item' => __( 'Edit Print', 'strip' ), |
|
447 | - 'update_item' => __( 'Update Pring', 'strip' ), |
|
448 | - 'view_item' => __( 'View Print', 'strip' ), |
|
449 | - 'separate_items_with_commas' => __( 'Separate prints with commas', 'strip' ), |
|
450 | - 'add_or_remove_items' => __( 'Add or remove prints', 'strip' ), |
|
451 | - 'choose_from_most_used' => __( 'Choose from the most used', 'strip' ), |
|
452 | - 'popular_items' => __( 'Popular Prints', 'strip' ), |
|
453 | - 'search_items' => __( 'Search Prints', 'strip' ), |
|
454 | - 'not_found' => __( 'Not Found', 'strip' ), |
|
455 | - 'no_terms' => __( 'No prints', 'strip' ), |
|
456 | - 'items_list' => __( 'Prints list', 'strip' ), |
|
457 | - 'items_list_navigation' => __( 'Prints list navigation', 'strip' ), |
|
438 | + 'name' => _x('Prints', 'Taxonomy General Name', 'strip'), |
|
439 | + 'singular_name' => _x('Print', 'Taxonomy Singular Name', 'strip'), |
|
440 | + 'menu_name' => __('Print', 'strip'), |
|
441 | + 'all_items' => __('All Prints', 'strip'), |
|
442 | + 'parent_item' => __('Parent Print', 'strip'), |
|
443 | + 'parent_item_colon' => __('Parent Print:', 'strip'), |
|
444 | + 'new_item_name' => __('New Print Name', 'strip'), |
|
445 | + 'add_new_item' => __('Add New Print', 'strip'), |
|
446 | + 'edit_item' => __('Edit Print', 'strip'), |
|
447 | + 'update_item' => __('Update Pring', 'strip'), |
|
448 | + 'view_item' => __('View Print', 'strip'), |
|
449 | + 'separate_items_with_commas' => __('Separate prints with commas', 'strip'), |
|
450 | + 'add_or_remove_items' => __('Add or remove prints', 'strip'), |
|
451 | + 'choose_from_most_used' => __('Choose from the most used', 'strip'), |
|
452 | + 'popular_items' => __('Popular Prints', 'strip'), |
|
453 | + 'search_items' => __('Search Prints', 'strip'), |
|
454 | + 'not_found' => __('Not Found', 'strip'), |
|
455 | + 'no_terms' => __('No prints', 'strip'), |
|
456 | + 'items_list' => __('Prints list', 'strip'), |
|
457 | + 'items_list_navigation' => __('Prints list navigation', 'strip'), |
|
458 | 458 | ); |
459 | 459 | |
460 | 460 | $args = array( |
@@ -466,21 +466,21 @@ discard block |
||
466 | 466 | 'show_in_nav_menus' => true, |
467 | 467 | 'show_tagcloud' => true, |
468 | 468 | ); |
469 | - register_taxonomy( 'print', array( 'comic' ), $args ); |
|
469 | + register_taxonomy('print', array('comic'), $args); |
|
470 | 470 | |
471 | 471 | /* |
472 | 472 | * WooCommerce Hooks |
473 | 473 | * Layout |
474 | 474 | */ |
475 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); |
|
476 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
477 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
475 | + remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
|
476 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
477 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
478 | 478 | // remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); // removes woo pagination. |
479 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
480 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
479 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
480 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
481 | 481 | |
482 | - add_action( 'woocommerce_before_main_content', 'strip_wrapper_start', 10 ); |
|
483 | - add_action( 'woocommerce_after_main_content', 'strip_wrapper_end', 10 ); |
|
482 | + add_action('woocommerce_before_main_content', 'strip_wrapper_start', 10); |
|
483 | + add_action('woocommerce_after_main_content', 'strip_wrapper_end', 10); |
|
484 | 484 | |
485 | 485 | /** |
486 | 486 | * WooCommerce wrapper |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | echo '</section>'; |
497 | 497 | } |
498 | 498 | |
499 | - add_action( 'after_setup_theme', 'woocommerce_support' ); |
|
499 | + add_action('after_setup_theme', 'woocommerce_support'); |
|
500 | 500 | /** |
501 | 501 | * Add WooCommerce support |
502 | 502 | * https://docs.woothemes.com/document/third-party-custom-theme-compatibility/* |
503 | 503 | */ |
504 | 504 | function woocommerce_support() { |
505 | - add_theme_support( 'woocommerce' ); |
|
505 | + add_theme_support('woocommerce'); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | */ |
511 | 511 | function wp_enqueue_woocommerce_style() { |
512 | 512 | |
513 | - wp_register_style( 'strip-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce-min.css' ); |
|
514 | - if ( class_exists( 'woocommerce' ) ) { |
|
515 | - wp_enqueue_style( 'strip-woocommerce' ); |
|
513 | + wp_register_style('strip-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce-min.css'); |
|
514 | + if (class_exists('woocommerce')) { |
|
515 | + wp_enqueue_style('strip-woocommerce'); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
519 | - add_action( 'wp_enqueue_scripts', 'wp_enqueue_woocommerce_style' ); |
|
519 | + add_action('wp_enqueue_scripts', 'wp_enqueue_woocommerce_style'); |
|
520 | 520 | |
521 | 521 | /** |
522 | 522 | * Optimize WooCommerce Scripts |
@@ -527,53 +527,53 @@ discard block |
||
527 | 527 | * @link https://gist.github.com/DevinWalker/7621777 |
528 | 528 | * @link http://dessky.com/blog/disable-woocommerce-scripts-and-styles/ |
529 | 529 | */ |
530 | - add_action( 'wp_enqueue_scripts', 'strip_manage_woocommerce_styles', 99 ); |
|
530 | + add_action('wp_enqueue_scripts', 'strip_manage_woocommerce_styles', 99); |
|
531 | 531 | |
532 | 532 | /** |
533 | 533 | * Remove some WooCommerce queries. |
534 | 534 | */ |
535 | 535 | function strip_manage_woocommerce_styles() { |
536 | 536 | // remove generator meta tag. |
537 | - remove_action( 'wp_head', array( 'woocommerce', 'generator' ) ); |
|
537 | + remove_action('wp_head', array('woocommerce', 'generator')); |
|
538 | 538 | // first check that woo exists to prevent fatal errors. |
539 | - if ( function_exists( 'strip_is_woocommerce_activated' ) ) { |
|
539 | + if (function_exists('strip_is_woocommerce_activated')) { |
|
540 | 540 | // dequeue scripts and styles, unless we're in the store. |
541 | - if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { |
|
542 | - wp_dequeue_style( 'woocommerce_frontend_styles' ); |
|
543 | - wp_dequeue_style( 'woocommerce-general' ); |
|
544 | - wp_dequeue_style( 'woocommerce-layout' ); |
|
545 | - wp_dequeue_style( 'woocommerce-smallscreen' ); |
|
546 | - wp_dequeue_style( 'woocommerce_fancybox_styles' ); |
|
547 | - wp_dequeue_style( 'woocommerce_chosen_styles' ); |
|
548 | - wp_dequeue_style( 'woocommerce_prettyPhoto_css' ); |
|
549 | - wp_dequeue_style( 'select2' ); |
|
550 | - wp_dequeue_style( 'strip-woocommerce' ); // the theme's CSS overwrite. |
|
551 | - wp_dequeue_script( 'wc-add-payment-method' ); |
|
552 | - wp_dequeue_script( 'wc-lost-password' ); |
|
553 | - wp_dequeue_script( 'wc_price_slider' ); |
|
554 | - wp_dequeue_script( 'wc-single-product' ); |
|
555 | - wp_dequeue_script( 'wc-add-to-cart' ); |
|
556 | - wp_dequeue_script( 'wc-cart-fragments' ); |
|
557 | - wp_dequeue_script( 'wc-credit-card-form' ); |
|
558 | - wp_dequeue_script( 'wc-checkout' ); |
|
559 | - wp_dequeue_script( 'wc-add-to-cart-variation' ); |
|
560 | - wp_dequeue_script( 'wc-single-product' ); |
|
561 | - wp_dequeue_script( 'wc-cart' ); |
|
562 | - wp_dequeue_script( 'wc-chosen' ); |
|
563 | - wp_dequeue_script( 'woocommerce' ); |
|
564 | - wp_dequeue_script( 'jquery-cookie' ); |
|
565 | - wp_dequeue_script( 'prettyPhoto' ); |
|
566 | - wp_dequeue_script( 'prettyPhoto-init' ); |
|
567 | - wp_dequeue_script( 'jquery-blockui' ); |
|
568 | - wp_dequeue_script( 'jquery-placeholder' ); |
|
569 | - wp_dequeue_script( 'jquery-payment' ); |
|
570 | - wp_dequeue_script( 'fancybox' ); |
|
571 | - wp_dequeue_script( 'jqueryui' ); |
|
541 | + if ( ! is_woocommerce() && ! is_cart() && ! is_checkout()) { |
|
542 | + wp_dequeue_style('woocommerce_frontend_styles'); |
|
543 | + wp_dequeue_style('woocommerce-general'); |
|
544 | + wp_dequeue_style('woocommerce-layout'); |
|
545 | + wp_dequeue_style('woocommerce-smallscreen'); |
|
546 | + wp_dequeue_style('woocommerce_fancybox_styles'); |
|
547 | + wp_dequeue_style('woocommerce_chosen_styles'); |
|
548 | + wp_dequeue_style('woocommerce_prettyPhoto_css'); |
|
549 | + wp_dequeue_style('select2'); |
|
550 | + wp_dequeue_style('strip-woocommerce'); // the theme's CSS overwrite. |
|
551 | + wp_dequeue_script('wc-add-payment-method'); |
|
552 | + wp_dequeue_script('wc-lost-password'); |
|
553 | + wp_dequeue_script('wc_price_slider'); |
|
554 | + wp_dequeue_script('wc-single-product'); |
|
555 | + wp_dequeue_script('wc-add-to-cart'); |
|
556 | + wp_dequeue_script('wc-cart-fragments'); |
|
557 | + wp_dequeue_script('wc-credit-card-form'); |
|
558 | + wp_dequeue_script('wc-checkout'); |
|
559 | + wp_dequeue_script('wc-add-to-cart-variation'); |
|
560 | + wp_dequeue_script('wc-single-product'); |
|
561 | + wp_dequeue_script('wc-cart'); |
|
562 | + wp_dequeue_script('wc-chosen'); |
|
563 | + wp_dequeue_script('woocommerce'); |
|
564 | + wp_dequeue_script('jquery-cookie'); |
|
565 | + wp_dequeue_script('prettyPhoto'); |
|
566 | + wp_dequeue_script('prettyPhoto-init'); |
|
567 | + wp_dequeue_script('jquery-blockui'); |
|
568 | + wp_dequeue_script('jquery-placeholder'); |
|
569 | + wp_dequeue_script('jquery-payment'); |
|
570 | + wp_dequeue_script('fancybox'); |
|
571 | + wp_dequeue_script('jqueryui'); |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | } |
575 | 575 | |
576 | - add_action( 'pre_get_posts', 'strip_set_posts_per_page' ); |
|
576 | + add_action('pre_get_posts', 'strip_set_posts_per_page'); |
|
577 | 577 | /** |
578 | 578 | * Set posts, WooCommerce products & comics number per archive page |
579 | 579 | * Fixes 404 error on pagination due to CTP conflicting with WordPress posts_per_page default |
@@ -582,12 +582,12 @@ discard block |
||
582 | 582 | * @param WP_Query $query strip_set_posts_per_page. |
583 | 583 | * @return $query |
584 | 584 | */ |
585 | - function strip_set_posts_per_page( $query ) { |
|
586 | - if ( is_post_type_archive( 'product' ) ) { |
|
587 | - $query->set( 'posts_per_page', 4 ); |
|
585 | + function strip_set_posts_per_page($query) { |
|
586 | + if (is_post_type_archive('product')) { |
|
587 | + $query->set('posts_per_page', 4); |
|
588 | 588 | return $query; |
589 | - } elseif ( is_tax( 'story' ) ) { |
|
590 | - $query->set( 'posts_per_page', 6 ); |
|
589 | + } elseif (is_tax('story')) { |
|
590 | + $query->set('posts_per_page', 6); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
@@ -596,13 +596,13 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @param string $query strip_add_comics_to_blog. |
598 | 598 | */ |
599 | - function strip_add_comics_to_blog( $query ) { |
|
600 | - if ( is_home() && $query->is_main_query() ) { |
|
601 | - $query->set( 'post_type', array( 'post', 'comic' ) ); |
|
599 | + function strip_add_comics_to_blog($query) { |
|
600 | + if (is_home() && $query->is_main_query()) { |
|
601 | + $query->set('post_type', array('post', 'comic')); |
|
602 | 602 | return $query; |
603 | 603 | } |
604 | 604 | } |
605 | - add_action( 'pre_get_posts', 'strip_add_comics_to_blog' ); |
|
605 | + add_action('pre_get_posts', 'strip_add_comics_to_blog'); |
|
606 | 606 | |
607 | 607 | /** |
608 | 608 | * Set an automatic default custom taxonomy for comic posts. |
@@ -612,35 +612,35 @@ discard block |
||
612 | 612 | * @param string $post_id set_default_object_terms. |
613 | 613 | * @param string $post set_default_object_terms. |
614 | 614 | */ |
615 | - function set_default_object_terms( $post_id, $post ) { |
|
616 | - if ( 'publish' === $post->post_status && 'comic' === $post->post_type ) { |
|
615 | + function set_default_object_terms($post_id, $post) { |
|
616 | + if ('publish' === $post->post_status && 'comic' === $post->post_type) { |
|
617 | 617 | $defaults = array( |
618 | - 'story' => array( 'draft' ), |
|
618 | + 'story' => array('draft'), |
|
619 | 619 | ); |
620 | - $taxonomies = get_object_taxonomies( $post->post_type ); |
|
621 | - foreach ( (array) $taxonomies as $taxonomy ) { |
|
622 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
623 | - if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) { |
|
624 | - wp_set_object_terms( $post_id, $defaults[ $taxonomy ], $taxonomy ); |
|
620 | + $taxonomies = get_object_taxonomies($post->post_type); |
|
621 | + foreach ((array) $taxonomies as $taxonomy) { |
|
622 | + $terms = get_the_terms($post_id, $taxonomy); |
|
623 | + if (empty($terms) && array_key_exists($taxonomy, $defaults)) { |
|
624 | + wp_set_object_terms($post_id, $defaults[$taxonomy], $taxonomy); |
|
625 | 625 | } |
626 | 626 | } |
627 | 627 | } |
628 | 628 | } |
629 | - add_action( 'save_post', 'set_default_object_terms', 0, 2 ); |
|
629 | + add_action('save_post', 'set_default_object_terms', 0, 2); |
|
630 | 630 | |
631 | 631 | /** |
632 | 632 | * Remove jquery migrate $scripts for enhanced performance. |
633 | 633 | * |
634 | 634 | * @param strings $scripts remove_jquery_migrate. |
635 | 635 | */ |
636 | - function remove_jquery_migrate( $scripts ) { |
|
637 | - if ( is_admin() ) { |
|
636 | + function remove_jquery_migrate($scripts) { |
|
637 | + if (is_admin()) { |
|
638 | 638 | return; |
639 | 639 | } |
640 | - $scripts->remove( 'jquery' ); |
|
641 | - $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' ); |
|
640 | + $scripts->remove('jquery'); |
|
641 | + $scripts->add('jquery', false, array('jquery-core'), '1.10.2'); |
|
642 | 642 | } |
643 | - add_action( 'wp_default_scripts', 'remove_jquery_migrate' ); |
|
643 | + add_action('wp_default_scripts', 'remove_jquery_migrate'); |
|
644 | 644 | |
645 | 645 | /** |
646 | 646 | * Remove login errors notices (security) |
@@ -648,4 +648,4 @@ discard block |
||
648 | 648 | function no_wordpress_errors() { |
649 | 649 | return 'Something is wrong!'; |
650 | 650 | } |
651 | - add_filter( 'login_errors', 'no_wordpress_errors' ); |
|
651 | + add_filter('login_errors', 'no_wordpress_errors'); |