@@ -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( 'stri-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('stri-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. |
@@ -78,35 +78,35 @@ discard block |
||
78 | 78 | * @see http://codex.wordpress.org/Function_Reference/wpautop gets the same result |
79 | 79 | * but it removes line blocks: remove_filter( 'the_content', 'wpautop' ); |
80 | 80 | */ |
81 | - function filter_ptags_on_images( $content ) { |
|
82 | - return preg_replace( '/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content ); |
|
81 | + function filter_ptags_on_images($content) { |
|
82 | + return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); |
|
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,13 +114,13 @@ 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 | /** |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | * @link: http://cubiq.org/clean-up-and-optimize-wordpress-for-your-next-theme |
131 | 131 | */ |
132 | 132 | function strip_cleanup() { |
133 | - remove_action( 'wp_head', 'wp_generator' ); // WP Version. |
|
134 | - remove_action( 'wp_head', 'wlwmanifest_link' ); |
|
135 | - remove_action( 'wp_head', 'rsd_link' ); |
|
136 | - remove_action( 'wp_head', 'rel_canonical', 10, 0 ); |
|
137 | - remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 ); |
|
133 | + remove_action('wp_head', 'wp_generator'); // WP Version. |
|
134 | + remove_action('wp_head', 'wlwmanifest_link'); |
|
135 | + remove_action('wp_head', 'rsd_link'); |
|
136 | + remove_action('wp_head', 'rel_canonical', 10, 0); |
|
137 | + remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); |
|
138 | 138 | |
139 | - remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );// Parent rel link. |
|
140 | - remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // Start post rel link. |
|
141 | - remove_action( 'wp_head', 'index_rel_link' ); |
|
139 | + remove_action('wp_head', 'parent_post_rel_link', 10, 0); // Parent rel link. |
|
140 | + remove_action('wp_head', 'start_post_rel_link', 10, 0); // Start post rel link. |
|
141 | + remove_action('wp_head', 'index_rel_link'); |
|
142 | 142 | |
143 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); // Adjacent post rel link. |
|
143 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Adjacent post rel link. |
|
144 | 144 | |
145 | - add_filter( 'the_generator', '__return_false' ); |
|
145 | + add_filter('the_generator', '__return_false'); |
|
146 | 146 | |
147 | - remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
|
148 | - remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
|
147 | + remove_action('wp_head', 'print_emoji_detection_script', 7); |
|
148 | + remove_action('wp_print_styles', 'print_emoji_styles'); |
|
149 | 149 | } |
150 | 150 | /** |
151 | 151 | * Cleanup head remove rss version |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @param array $headers remove x pingback. |
162 | 162 | * @since 1.1.3 |
163 | 163 | */ |
164 | - function strip_remove_x_pingback( $headers ) { |
|
165 | - unset( $headers['X-Pingback'] ); |
|
164 | + function strip_remove_x_pingback($headers) { |
|
165 | + unset($headers['X-Pingback']); |
|
166 | 166 | return $headers; |
167 | 167 | } |
168 | 168 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | */ |
174 | 174 | function strip_remove_comments_inline_styles() { |
175 | 175 | global $wp_widget_factory; |
176 | - if ( has_filter( 'wp_head', 'wp_widget_recent_comments_style' ) ) { |
|
177 | - remove_filter( 'wp_head', 'wp_widget_recent_comments_style' ); |
|
176 | + if (has_filter('wp_head', 'wp_widget_recent_comments_style')) { |
|
177 | + remove_filter('wp_head', 'wp_widget_recent_comments_style'); |
|
178 | 178 | } |
179 | 179 | |
180 | - remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); |
|
180 | + remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style')); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | * This theme styles the visual editor to resemble the theme style, |
186 | 186 | * specifically font, colors, icons, and column width. |
187 | 187 | */ |
188 | - add_editor_style( array( '/assets/css/editor-style.css', '/assets/fonts/fenix.css' ) ); |
|
188 | + add_editor_style(array('/assets/css/editor-style.css', '/assets/fonts/fenix.css')); |
|
189 | 189 | |
190 | 190 | // Indicate widget sidebars can use selective refresh in the Customizer. |
191 | 191 | // See https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/ for detail. |
192 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
192 | + add_theme_support('customize-selective-refresh-widgets'); |
|
193 | 193 | endif; // strip_setup. |
194 | -add_action( 'after_setup_theme', 'strip_setup' ); |
|
194 | +add_action('after_setup_theme', 'strip_setup'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Register widgetized area and update sidebar with default widgets |
198 | 198 | */ |
199 | 199 | function strip_widgets_init() { |
200 | 200 | register_sidebar(array( |
201 | - 'name' => __( 'Main Sidebar', 'strip' ), |
|
201 | + 'name' => __('Main Sidebar', 'strip'), |
|
202 | 202 | 'id' => 'sidebar', |
203 | - 'description' => __( 'The main body widget area', 'strip' ), |
|
203 | + 'description' => __('The main body widget area', 'strip'), |
|
204 | 204 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
205 | 205 | 'after_widget' => '</aside>', |
206 | 206 | 'before_title' => '<h2 class="widget-title">', |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | )); |
209 | 209 | |
210 | 210 | // First footer widget area, located in the footer. Empty by default. |
211 | - register_sidebar( array( |
|
212 | - 'name' => __( 'First Footer Widget', 'strip' ), |
|
211 | + register_sidebar(array( |
|
212 | + 'name' => __('First Footer Widget', 'strip'), |
|
213 | 213 | 'id' => 'first-footer-widget', |
214 | - 'description' => __( 'The first footer widget', 'strip' ), |
|
214 | + 'description' => __('The first footer widget', 'strip'), |
|
215 | 215 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
216 | 216 | 'after_widget' => '</aside>', |
217 | 217 | 'before_title' => '<h3 class="widget-title">', |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | |
221 | 221 | // Second Footer Widget Area, located in the footer. Empty by default. |
222 | 222 | register_sidebar(array( |
223 | - 'name' => __( 'Second Footer Widget', 'strip' ), |
|
223 | + 'name' => __('Second Footer Widget', 'strip'), |
|
224 | 224 | 'id' => 'second-footer-widget', |
225 | - 'description' => __( 'The second footer widget', 'strip' ), |
|
225 | + 'description' => __('The second footer widget', 'strip'), |
|
226 | 226 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
227 | 227 | 'after_widget' => '</aside>', |
228 | 228 | 'before_title' => '<h3 class="widget-title">', |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | |
232 | 232 | // Third Footer Widget Area, located in the footer. Empty by default. |
233 | 233 | register_sidebar(array( |
234 | - 'name' => __( 'Third Footer Widget', 'strip' ), |
|
234 | + 'name' => __('Third Footer Widget', 'strip'), |
|
235 | 235 | 'id' => 'third-footer-widget', |
236 | - 'description' => __( 'The third footer widget', 'strip' ), |
|
236 | + 'description' => __('The third footer widget', 'strip'), |
|
237 | 237 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
238 | 238 | 'after_widget' => '</aside>', |
239 | 239 | 'before_title' => '<h3 class="widget-title">', |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | |
243 | 243 | // Fourth Footer Widget Area, located in the footer. Empty by default. |
244 | 244 | register_sidebar(array( |
245 | - 'name' => __( 'Fourth Footer Widget', 'strip' ), |
|
245 | + 'name' => __('Fourth Footer Widget', 'strip'), |
|
246 | 246 | 'id' => 'fourth-footer-widget', |
247 | - 'description' => __( 'The fourth footer widget', 'strip' ), |
|
247 | + 'description' => __('The fourth footer widget', 'strip'), |
|
248 | 248 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
249 | 249 | 'after_widget' => '</aside>', |
250 | 250 | 'before_title' => '<h3 class="widget-title">', |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | )); |
253 | 253 | |
254 | 254 | } |
255 | -add_action( 'widgets_init', 'strip_widgets_init' ); |
|
255 | +add_action('widgets_init', 'strip_widgets_init'); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Handles JavaScript detection. |
@@ -264,47 +264,47 @@ discard block |
||
264 | 264 | function strip_javascript_detection() { |
265 | 265 | echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n"; |
266 | 266 | } |
267 | -add_action( 'wp_head', 'strip_javascript_detection', 0 ); |
|
267 | +add_action('wp_head', 'strip_javascript_detection', 0); |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Enqueue_styles for custom fonts. |
271 | 271 | */ |
272 | 272 | function strip_scripts() { |
273 | 273 | // add custom font here if any. |
274 | - wp_enqueue_style( 'fenix', get_template_directory_uri() . '/assets/fonts/fenix.css', array(), null ); |
|
274 | + wp_enqueue_style('fenix', get_template_directory_uri() . '/assets/fonts/fenix.css', array(), null); |
|
275 | 275 | |
276 | - wp_enqueue_style( 'inconsolata', get_template_directory_uri() . '/assets/fonts/inconsolata.css', array(), null ); |
|
276 | + wp_enqueue_style('inconsolata', get_template_directory_uri() . '/assets/fonts/inconsolata.css', array(), null); |
|
277 | 277 | |
278 | 278 | // Theme stylesheet. |
279 | - wp_enqueue_style( 'strip-style', get_stylesheet_uri() ); |
|
279 | + wp_enqueue_style('strip-style', get_stylesheet_uri()); |
|
280 | 280 | |
281 | 281 | // Load the Internet Explorer specific stylesheet. Conditional stylesheet — tested and works with IE9 on Windows7. |
282 | - wp_enqueue_style( 'strip-ie', get_template_directory_uri() . 'assets/css/ie.css', array( 'strip-style' ), '20160305' ); |
|
283 | - wp_style_add_data( 'strip-ie', 'conditional', 'lt IE 10' ); |
|
282 | + wp_enqueue_style('strip-ie', get_template_directory_uri() . 'assets/css/ie.css', array('strip-style'), '20160305'); |
|
283 | + wp_style_add_data('strip-ie', 'conditional', 'lt IE 10'); |
|
284 | 284 | |
285 | - if ( has_nav_menu( 'primary' ) ) { |
|
286 | - wp_enqueue_script( 'strip-navigation', get_template_directory_uri() . '/assets/js/min/navigation-min.js', array(), '1.0', true ); |
|
285 | + if (has_nav_menu('primary')) { |
|
286 | + wp_enqueue_script('strip-navigation', get_template_directory_uri() . '/assets/js/min/navigation-min.js', array(), '1.0', true); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Load the html5 shiv. |
290 | - wp_enqueue_script( 'strip-html5', get_template_directory_uri() . '/assets/js/min/html5-min.js', array(), '3.7.3' ); |
|
291 | - wp_script_add_data( 'strip-html5', 'conditional', 'lt IE 9' ); |
|
290 | + wp_enqueue_script('strip-html5', get_template_directory_uri() . '/assets/js/min/html5-min.js', array(), '3.7.3'); |
|
291 | + wp_script_add_data('strip-html5', 'conditional', 'lt IE 9'); |
|
292 | 292 | |
293 | - 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 ); |
|
293 | + 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); |
|
294 | 294 | |
295 | 295 | // toggle comments js. |
296 | - wp_enqueue_script( 'strip-toggle-comments', get_template_directory_uri() . '/assets/js/min/toggle-comments-min.js', array( 'jquery' ), '1.2', true ); |
|
296 | + wp_enqueue_script('strip-toggle-comments', get_template_directory_uri() . '/assets/js/min/toggle-comments-min.js', array('jquery'), '1.2', true); |
|
297 | 297 | |
298 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
299 | - wp_enqueue_script( 'comment-reply' ); |
|
298 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
299 | + wp_enqueue_script('comment-reply'); |
|
300 | 300 | |
301 | - if ( is_single() && wp_attachment_is_image() ) { |
|
302 | - wp_enqueue_script( 'strip-keyboard-image-navigation', get_template_directory_uri() . '/assets/js/min/keyboard-image-navigation-min.js', array( 'jquery' ), '20160412', true ); |
|
301 | + if (is_single() && wp_attachment_is_image()) { |
|
302 | + wp_enqueue_script('strip-keyboard-image-navigation', get_template_directory_uri() . '/assets/js/min/keyboard-image-navigation-min.js', array('jquery'), '20160412', true); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | -add_action( 'wp_enqueue_scripts', 'strip_scripts' ); |
|
307 | +add_action('wp_enqueue_scripts', 'strip_scripts'); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Implement the Custom Header feature. |
@@ -331,14 +331,14 @@ discard block |
||
331 | 331 | */ |
332 | 332 | require get_template_directory() . '/inc/jetpack.php'; |
333 | 333 | |
334 | -add_action( 'wp_enqueue_scripts', 'enqueue_royal_sliders' ); |
|
334 | +add_action('wp_enqueue_scripts', 'enqueue_royal_sliders'); |
|
335 | 335 | /** |
336 | 336 | * Register RoyalSLider |
337 | 337 | */ |
338 | 338 | function enqueue_royal_sliders() { |
339 | - if ( function_exists( 'register_new_royalslider_files' ) ) { |
|
339 | + if (function_exists('register_new_royalslider_files')) { |
|
340 | 340 | // you could try this: if ( is_single() && is_archive() ) { but you don't really need it. |
341 | - register_new_royalslider_files( 1 ); // place register_new_royalslider_files function here, 1 is your slider's configuration number |
|
341 | + register_new_royalslider_files(1); // place register_new_royalslider_files function here, 1 is your slider's configuration number |
|
342 | 342 | // add } if use is_single etc. |
343 | 343 | } |
344 | 344 | } |
@@ -353,22 +353,22 @@ discard block |
||
353 | 353 | function get_first_image() { |
354 | 354 | global $post; |
355 | 355 | $first_img = ''; |
356 | - preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', do_shortcode( $post->post_content, 'gallery' ), $matches ); |
|
357 | - $first_img = isset( $matches[1][0] ) ? $matches[1][0] : null; |
|
356 | + preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', do_shortcode($post->post_content, 'gallery'), $matches); |
|
357 | + $first_img = isset($matches[1][0]) ? $matches[1][0] : null; |
|
358 | 358 | |
359 | - if ( empty( $first_img ) ) { |
|
359 | + if (empty($first_img)) { |
|
360 | 360 | return get_template_directory_uri() . '/assets/images/empty.png'; // path to default image. |
361 | 361 | } |
362 | 362 | |
363 | 363 | // Now we have the $first_img but we want the thumbnail of that image. |
364 | - $explode = explode( '.', $first_img ); |
|
365 | - $count = count( $explode ); |
|
364 | + $explode = explode('.', $first_img); |
|
365 | + $count = count($explode); |
|
366 | 366 | $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. |
367 | - $explode[ $count -2 ] = $explode[ $count -2 ] . '' . $size; |
|
368 | - $thumb_img = implode( '.', $explode ); |
|
367 | + $explode[$count - 2] = $explode[$count - 2] . '' . $size; |
|
368 | + $thumb_img = implode('.', $explode); |
|
369 | 369 | return $thumb_img; |
370 | 370 | } |
371 | - add_filter( 'get_first_image', 'thumbnail' ); |
|
371 | + add_filter('get_first_image', 'thumbnail'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Register Custom Post Type for comics |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | function comic_post_type() { |
377 | 377 | |
378 | 378 | $labels = array( |
379 | - 'name' => _x( 'Comics', 'Post Type General Name', 'strip' ), |
|
380 | - 'singular_name' => _x( 'Comic', 'Post Type Singular Name', 'strip' ), |
|
381 | - 'menu_name' => _x( 'Comics', 'admin menu', 'strip' ), |
|
382 | - 'name_admin_bar' => _x( 'Comic', 'add new on admin bar', 'strip' ), |
|
383 | - 'parent_item_colon' => __( 'Parent Comic:', 'strip' ), |
|
384 | - 'all_items' => __( 'All Comics', 'strip' ), |
|
385 | - 'add_new_item' => __( 'Add New Comic', 'strip' ), |
|
386 | - 'add_new' => __( 'Add New Comic', 'strip' ), |
|
387 | - 'new_item' => __( 'New Comic', 'strip' ), |
|
388 | - 'edit_item' => __( 'Edit Comic', 'strip' ), |
|
389 | - 'update_item' => __( 'Update Comic', 'strip' ), |
|
390 | - 'view_item' => __( 'View Comic', 'strip' ), |
|
391 | - 'search_items' => __( 'Search Item', 'strip' ), |
|
392 | - 'not_found' => __( 'No Comics found', 'strip' ), |
|
393 | - 'not_found_in_trash' => __( 'No Comics found in Trash', 'strip' ), |
|
394 | - 'items_list' => __( 'Comics list', 'strip' ), |
|
395 | - 'items_list_navigation' => __( 'Comics list navigation', 'strip' ), |
|
396 | - 'filter_items_list' => __( 'Filter Comics list', 'strip' ), |
|
379 | + 'name' => _x('Comics', 'Post Type General Name', 'strip'), |
|
380 | + 'singular_name' => _x('Comic', 'Post Type Singular Name', 'strip'), |
|
381 | + 'menu_name' => _x('Comics', 'admin menu', 'strip'), |
|
382 | + 'name_admin_bar' => _x('Comic', 'add new on admin bar', 'strip'), |
|
383 | + 'parent_item_colon' => __('Parent Comic:', 'strip'), |
|
384 | + 'all_items' => __('All Comics', 'strip'), |
|
385 | + 'add_new_item' => __('Add New Comic', 'strip'), |
|
386 | + 'add_new' => __('Add New Comic', 'strip'), |
|
387 | + 'new_item' => __('New Comic', 'strip'), |
|
388 | + 'edit_item' => __('Edit Comic', 'strip'), |
|
389 | + 'update_item' => __('Update Comic', 'strip'), |
|
390 | + 'view_item' => __('View Comic', 'strip'), |
|
391 | + 'search_items' => __('Search Item', 'strip'), |
|
392 | + 'not_found' => __('No Comics found', 'strip'), |
|
393 | + 'not_found_in_trash' => __('No Comics found in Trash', 'strip'), |
|
394 | + 'items_list' => __('Comics list', 'strip'), |
|
395 | + 'items_list_navigation' => __('Comics list navigation', 'strip'), |
|
396 | + 'filter_items_list' => __('Filter Comics list', 'strip'), |
|
397 | 397 | ); |
398 | 398 | |
399 | 399 | $supports = array( |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | ); |
411 | 411 | |
412 | 412 | $args = array( |
413 | - 'label' => __( 'Comic', 'strip' ), |
|
414 | - 'description' => __( 'Publish Comics and Webcomics', 'strip' ), |
|
413 | + 'label' => __('Comic', 'strip'), |
|
414 | + 'description' => __('Publish Comics and Webcomics', 'strip'), |
|
415 | 415 | 'labels' => $labels, |
416 | 416 | 'supports' => $supports, |
417 | - 'taxonomies' => array( 'story', 'story_term', 'draft' ), |
|
417 | + 'taxonomies' => array('story', 'story_term', 'draft'), |
|
418 | 418 | 'hierarchical' => true, |
419 | 419 | 'public' => true, |
420 | 420 | 'show_ui' => true, |
@@ -427,40 +427,40 @@ discard block |
||
427 | 427 | 'has_archive' => true, |
428 | 428 | 'feeds' => true, |
429 | 429 | 'exclude_from_search' => false, |
430 | - 'rewrite' => array( 'slug' => 'stories', 'with_front' => true ), |
|
430 | + 'rewrite' => array('slug' => 'stories', 'with_front' => true), |
|
431 | 431 | 'publicly_queryable' => true, |
432 | 432 | 'capability_type' => 'post', |
433 | 433 | ); |
434 | - register_post_type( 'comic', $args ); |
|
434 | + register_post_type('comic', $args); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | // Hook into the 'init' action. |
438 | -add_action( 'init', 'comic_post_type', 0 ); // End of register_cpt_comic(). |
|
438 | +add_action('init', 'comic_post_type', 0); // End of register_cpt_comic(). |
|
439 | 439 | |
440 | 440 | /** |
441 | 441 | * Register Custom Taxonomy 'story' |
442 | 442 | */ |
443 | 443 | function comic_story_taxonomy() { |
444 | 444 | $labels = array( |
445 | - 'name' => _x( 'Comic Story', 'Taxonomy General Name', 'strip' ), |
|
446 | - 'singular_name' => _x( 'Comic Story', 'Taxonomy Singular Name', 'strip' ), |
|
447 | - 'menu_name' => __( 'Comic Stories', 'strip' ), |
|
448 | - 'all_items' => __( 'All Comic Stories', 'strip' ), |
|
449 | - 'parent_item' => __( 'Parent Story', 'strip' ), |
|
450 | - 'parent_item_colon' => __( 'Parent Story:', 'strip' ), |
|
451 | - 'new_item_name' => __( 'New Comic Story', 'strip' ), |
|
452 | - 'add_new_item' => __( 'Add New Story', 'strip' ), |
|
453 | - 'edit_item' => __( 'Edit Story', 'strip' ), |
|
454 | - 'update_item' => __( 'Update Story', 'strip' ), |
|
455 | - 'view_item' => __( 'View Item', 'strip' ), |
|
456 | - 'separate_items_with_commas' => __( 'Separate stories with commas', 'strip' ), |
|
457 | - 'add_or_remove_items' => __( 'Add or Remove Stories', 'strip' ), |
|
458 | - 'choose_from_most_used' => __( 'Choose from the most used stories', 'strip' ), |
|
459 | - 'popular_items' => __( 'Popular comic stories', 'strip' ), |
|
460 | - 'search_items' => __( 'Search Stories', 'strip' ), |
|
461 | - 'not_found' => __( 'No comic Stories found', 'strip' ), |
|
462 | - 'items_list' => __( 'Comic Stories list', 'strip' ), |
|
463 | - 'items_list_navigation' => __( 'Comic Stories list navigation', 'strip' ), |
|
445 | + 'name' => _x('Comic Story', 'Taxonomy General Name', 'strip'), |
|
446 | + 'singular_name' => _x('Comic Story', 'Taxonomy Singular Name', 'strip'), |
|
447 | + 'menu_name' => __('Comic Stories', 'strip'), |
|
448 | + 'all_items' => __('All Comic Stories', 'strip'), |
|
449 | + 'parent_item' => __('Parent Story', 'strip'), |
|
450 | + 'parent_item_colon' => __('Parent Story:', 'strip'), |
|
451 | + 'new_item_name' => __('New Comic Story', 'strip'), |
|
452 | + 'add_new_item' => __('Add New Story', 'strip'), |
|
453 | + 'edit_item' => __('Edit Story', 'strip'), |
|
454 | + 'update_item' => __('Update Story', 'strip'), |
|
455 | + 'view_item' => __('View Item', 'strip'), |
|
456 | + 'separate_items_with_commas' => __('Separate stories with commas', 'strip'), |
|
457 | + 'add_or_remove_items' => __('Add or Remove Stories', 'strip'), |
|
458 | + 'choose_from_most_used' => __('Choose from the most used stories', 'strip'), |
|
459 | + 'popular_items' => __('Popular comic stories', 'strip'), |
|
460 | + 'search_items' => __('Search Stories', 'strip'), |
|
461 | + 'not_found' => __('No comic Stories found', 'strip'), |
|
462 | + 'items_list' => __('Comic Stories list', 'strip'), |
|
463 | + 'items_list_navigation' => __('Comic Stories list navigation', 'strip'), |
|
464 | 464 | ); |
465 | 465 | $args = array( |
466 | 466 | 'labels' => $labels, |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | 'show_in_nav_menus' => true, |
473 | 473 | 'show_tagcloud' => true, |
474 | 474 | 'query_var' => true, |
475 | - 'rewrite' => array( 'slug' => 'story' ), |
|
475 | + 'rewrite' => array('slug' => 'story'), |
|
476 | 476 | ); |
477 | - register_taxonomy( 'story', array( 'comic' ), $args ); |
|
478 | - register_taxonomy_for_object_type( 'story', 'comic' ); |
|
477 | + register_taxonomy('story', array('comic'), $args); |
|
478 | + register_taxonomy_for_object_type('story', 'comic'); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | // Hook into the 'init' action. |
482 | -add_action( 'init', 'comic_story_taxonomy', 0 ); |
|
482 | +add_action('init', 'comic_story_taxonomy', 0); |
|
483 | 483 | |
484 | 484 | /** |
485 | 485 | * Function strip rewrite rules. |
@@ -488,31 +488,31 @@ discard block |
||
488 | 488 | flush_rewrite_rules(); |
489 | 489 | } |
490 | 490 | /* Flush rewrite rules for custom post types. */ |
491 | -add_action( 'after_switch_theme', 'strip_rewrite_rules' ); |
|
491 | +add_action('after_switch_theme', 'strip_rewrite_rules'); |
|
492 | 492 | |
493 | 493 | // Add Print taxonomy, NOT hierarchical (like tags) |
494 | 494 | // Register Custom Taxonomy. |
495 | 495 | $labels = array( |
496 | - 'name' => _x( 'Prints', 'Taxonomy General Name', 'strip' ), |
|
497 | - 'singular_name' => _x( 'Print', 'Taxonomy Singular Name', 'strip' ), |
|
498 | - 'menu_name' => __( 'Print', 'strip' ), |
|
499 | - 'all_items' => __( 'All Prints', 'strip' ), |
|
500 | - 'parent_item' => __( 'Parent Print', 'strip' ), |
|
501 | - 'parent_item_colon' => __( 'Parent Print:', 'strip' ), |
|
502 | - 'new_item_name' => __( 'New Print Name', 'strip' ), |
|
503 | - 'add_new_item' => __( 'Add New Print', 'strip' ), |
|
504 | - 'edit_item' => __( 'Edit Print', 'strip' ), |
|
505 | - 'update_item' => __( 'Update Pring', 'strip' ), |
|
506 | - 'view_item' => __( 'View Print', 'strip' ), |
|
507 | - 'separate_items_with_commas' => __( 'Separate prints with commas', 'strip' ), |
|
508 | - 'add_or_remove_items' => __( 'Add or remove prints', 'strip' ), |
|
509 | - 'choose_from_most_used' => __( 'Choose from the most used', 'strip' ), |
|
510 | - 'popular_items' => __( 'Popular Prints', 'strip' ), |
|
511 | - 'search_items' => __( 'Search Prints', 'strip' ), |
|
512 | - 'not_found' => __( 'Not Found', 'strip' ), |
|
513 | - 'no_terms' => __( 'No prints', 'strip' ), |
|
514 | - 'items_list' => __( 'Prints list', 'strip' ), |
|
515 | - 'items_list_navigation' => __( 'Prints list navigation', 'strip' ), |
|
496 | + 'name' => _x('Prints', 'Taxonomy General Name', 'strip'), |
|
497 | + 'singular_name' => _x('Print', 'Taxonomy Singular Name', 'strip'), |
|
498 | + 'menu_name' => __('Print', 'strip'), |
|
499 | + 'all_items' => __('All Prints', 'strip'), |
|
500 | + 'parent_item' => __('Parent Print', 'strip'), |
|
501 | + 'parent_item_colon' => __('Parent Print:', 'strip'), |
|
502 | + 'new_item_name' => __('New Print Name', 'strip'), |
|
503 | + 'add_new_item' => __('Add New Print', 'strip'), |
|
504 | + 'edit_item' => __('Edit Print', 'strip'), |
|
505 | + 'update_item' => __('Update Pring', 'strip'), |
|
506 | + 'view_item' => __('View Print', 'strip'), |
|
507 | + 'separate_items_with_commas' => __('Separate prints with commas', 'strip'), |
|
508 | + 'add_or_remove_items' => __('Add or remove prints', 'strip'), |
|
509 | + 'choose_from_most_used' => __('Choose from the most used', 'strip'), |
|
510 | + 'popular_items' => __('Popular Prints', 'strip'), |
|
511 | + 'search_items' => __('Search Prints', 'strip'), |
|
512 | + 'not_found' => __('Not Found', 'strip'), |
|
513 | + 'no_terms' => __('No prints', 'strip'), |
|
514 | + 'items_list' => __('Prints list', 'strip'), |
|
515 | + 'items_list_navigation' => __('Prints list navigation', 'strip'), |
|
516 | 516 | ); |
517 | 517 | |
518 | 518 | $args = array( |
@@ -524,21 +524,21 @@ discard block |
||
524 | 524 | 'show_in_nav_menus' => true, |
525 | 525 | 'show_tagcloud' => true, |
526 | 526 | ); |
527 | - register_taxonomy( 'print', array( 'comic' ), $args ); |
|
527 | + register_taxonomy('print', array('comic'), $args); |
|
528 | 528 | |
529 | 529 | /* |
530 | 530 | * WooCommerce Hooks |
531 | 531 | * Layout |
532 | 532 | */ |
533 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); |
|
534 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
535 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
536 | - remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
537 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
538 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
533 | + remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
|
534 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
535 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
536 | + remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
537 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
538 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
539 | 539 | |
540 | - add_action( 'woocommerce_before_main_content', 'strip_wrapper_start', 10 ); |
|
541 | - add_action( 'woocommerce_after_main_content', 'strip_wrapper_end', 10 ); |
|
540 | + add_action('woocommerce_before_main_content', 'strip_wrapper_start', 10); |
|
541 | + add_action('woocommerce_after_main_content', 'strip_wrapper_end', 10); |
|
542 | 542 | |
543 | 543 | /** |
544 | 544 | * WooCommerce wrapper |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | echo '</section>'; |
555 | 555 | } |
556 | 556 | |
557 | - add_action( 'after_setup_theme', 'woocommerce_support' ); |
|
557 | + add_action('after_setup_theme', 'woocommerce_support'); |
|
558 | 558 | /** |
559 | 559 | * Add WooCommerce support |
560 | 560 | * https://docs.woothemes.com/document/third-party-custom-theme-compatibility/* |
561 | 561 | */ |
562 | 562 | function woocommerce_support() { |
563 | - add_theme_support( 'woocommerce' ); |
|
563 | + add_theme_support('woocommerce'); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | */ |
569 | 569 | function wp_enqueue_woocommerce_style() { |
570 | 570 | |
571 | - wp_register_style( 'strip-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce-min.css' ); |
|
572 | - if ( class_exists( 'woocommerce' ) ) { |
|
573 | - wp_enqueue_style( 'strip-woocommerce' ); |
|
571 | + wp_register_style('strip-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce-min.css'); |
|
572 | + if (class_exists('woocommerce')) { |
|
573 | + wp_enqueue_style('strip-woocommerce'); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
577 | - add_action( 'wp_enqueue_scripts', 'wp_enqueue_woocommerce_style' ); |
|
577 | + add_action('wp_enqueue_scripts', 'wp_enqueue_woocommerce_style'); |
|
578 | 578 | |
579 | 579 | /** |
580 | 580 | * Optimize WooCommerce Scripts |
@@ -585,53 +585,53 @@ discard block |
||
585 | 585 | * @link https://gist.github.com/DevinWalker/7621777 |
586 | 586 | * @link http://dessky.com/blog/disable-woocommerce-scripts-and-styles/ |
587 | 587 | */ |
588 | - add_action( 'wp_enqueue_scripts', 'strip_manage_woocommerce_styles', 99 ); |
|
588 | + add_action('wp_enqueue_scripts', 'strip_manage_woocommerce_styles', 99); |
|
589 | 589 | |
590 | 590 | /** |
591 | 591 | * Remove some WooCommerce queries. |
592 | 592 | */ |
593 | 593 | function strip_manage_woocommerce_styles() { |
594 | 594 | // remove generator meta tag. |
595 | - remove_action( 'wp_head', array( 'woocommerce', 'generator' ) ); // this line when used with $GLOBALS['woocommerce'] prompts an error when Woo is deactivated though. |
|
595 | + remove_action('wp_head', array('woocommerce', 'generator')); // this line when used with $GLOBALS['woocommerce'] prompts an error when Woo is deactivated though. |
|
596 | 596 | // first check that woo exists to prevent fatal errors. |
597 | - if ( function_exists( 'strip_is_woocommerce_activated' ) ) { |
|
597 | + if (function_exists('strip_is_woocommerce_activated')) { |
|
598 | 598 | // dequeue scripts and styles, unless we're in the store. |
599 | - if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { |
|
600 | - wp_dequeue_style( 'woocommerce_frontend_styles' ); |
|
601 | - wp_dequeue_style( 'woocommerce-general' ); |
|
602 | - wp_dequeue_style( 'woocommerce-layout' ); |
|
603 | - wp_dequeue_style( 'woocommerce-smallscreen' ); |
|
604 | - wp_dequeue_style( 'woocommerce_fancybox_styles' ); |
|
605 | - wp_dequeue_style( 'woocommerce_chosen_styles' ); |
|
606 | - wp_dequeue_style( 'woocommerce_prettyPhoto_css' ); |
|
607 | - wp_dequeue_style( 'select2' ); |
|
608 | - wp_dequeue_style( 'strip-woocommerce' ); // the theme's CSS overwrite. |
|
609 | - wp_dequeue_script( 'wc-add-payment-method' ); |
|
610 | - wp_dequeue_script( 'wc-lost-password' ); |
|
611 | - wp_dequeue_script( 'wc_price_slider' ); |
|
612 | - wp_dequeue_script( 'wc-single-product' ); |
|
613 | - wp_dequeue_script( 'wc-add-to-cart' ); |
|
614 | - wp_dequeue_script( 'wc-cart-fragments' ); |
|
615 | - wp_dequeue_script( 'wc-credit-card-form' ); |
|
616 | - wp_dequeue_script( 'wc-checkout' ); |
|
617 | - wp_dequeue_script( 'wc-add-to-cart-variation' ); |
|
618 | - wp_dequeue_script( 'wc-single-product' ); |
|
619 | - wp_dequeue_script( 'wc-cart' ); |
|
620 | - wp_dequeue_script( 'wc-chosen' ); |
|
621 | - wp_dequeue_script( 'woocommerce' ); |
|
622 | - wp_dequeue_script( 'jquery-cookie' ); |
|
623 | - wp_dequeue_script( 'prettyPhoto' ); |
|
624 | - wp_dequeue_script( 'prettyPhoto-init' ); |
|
625 | - wp_dequeue_script( 'jquery-blockui' ); |
|
626 | - wp_dequeue_script( 'jquery-placeholder' ); |
|
627 | - wp_dequeue_script( 'jquery-payment' ); |
|
628 | - wp_dequeue_script( 'fancybox' ); |
|
629 | - wp_dequeue_script( 'jqueryui' ); |
|
599 | + if ( ! is_woocommerce() && ! is_cart() && ! is_checkout()) { |
|
600 | + wp_dequeue_style('woocommerce_frontend_styles'); |
|
601 | + wp_dequeue_style('woocommerce-general'); |
|
602 | + wp_dequeue_style('woocommerce-layout'); |
|
603 | + wp_dequeue_style('woocommerce-smallscreen'); |
|
604 | + wp_dequeue_style('woocommerce_fancybox_styles'); |
|
605 | + wp_dequeue_style('woocommerce_chosen_styles'); |
|
606 | + wp_dequeue_style('woocommerce_prettyPhoto_css'); |
|
607 | + wp_dequeue_style('select2'); |
|
608 | + wp_dequeue_style('strip-woocommerce'); // the theme's CSS overwrite. |
|
609 | + wp_dequeue_script('wc-add-payment-method'); |
|
610 | + wp_dequeue_script('wc-lost-password'); |
|
611 | + wp_dequeue_script('wc_price_slider'); |
|
612 | + wp_dequeue_script('wc-single-product'); |
|
613 | + wp_dequeue_script('wc-add-to-cart'); |
|
614 | + wp_dequeue_script('wc-cart-fragments'); |
|
615 | + wp_dequeue_script('wc-credit-card-form'); |
|
616 | + wp_dequeue_script('wc-checkout'); |
|
617 | + wp_dequeue_script('wc-add-to-cart-variation'); |
|
618 | + wp_dequeue_script('wc-single-product'); |
|
619 | + wp_dequeue_script('wc-cart'); |
|
620 | + wp_dequeue_script('wc-chosen'); |
|
621 | + wp_dequeue_script('woocommerce'); |
|
622 | + wp_dequeue_script('jquery-cookie'); |
|
623 | + wp_dequeue_script('prettyPhoto'); |
|
624 | + wp_dequeue_script('prettyPhoto-init'); |
|
625 | + wp_dequeue_script('jquery-blockui'); |
|
626 | + wp_dequeue_script('jquery-placeholder'); |
|
627 | + wp_dequeue_script('jquery-payment'); |
|
628 | + wp_dequeue_script('fancybox'); |
|
629 | + wp_dequeue_script('jqueryui'); |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - add_action( 'pre_get_posts', 'strip_set_posts_per_page' ); |
|
634 | + add_action('pre_get_posts', 'strip_set_posts_per_page'); |
|
635 | 635 | /** |
636 | 636 | * Set posts, WooCommerce products & comics number per archive page |
637 | 637 | * Fixes 404 error on pagination due to CTP conflicting with WordPress posts_per_page default |
@@ -640,29 +640,29 @@ discard block |
||
640 | 640 | * @param WP_Query $query strip_set_posts_per_page. |
641 | 641 | * @return $query |
642 | 642 | */ |
643 | - function strip_set_posts_per_page( $query ) { |
|
643 | + function strip_set_posts_per_page($query) { |
|
644 | 644 | global $wp_the_query; |
645 | - if ( $wp_the_query-> is_home() && $wp_the_query-> is_search() ) { |
|
646 | - $query->set( 'post_type', array( 'post', 'comic', 'posts_per_page', 12 ) ); |
|
645 | + if ($wp_the_query-> is_home() && $wp_the_query-> is_search()) { |
|
646 | + $query->set('post_type', array('post', 'comic', 'posts_per_page', 12)); |
|
647 | 647 | } |
648 | - if ( $wp_the_query-> is_post_type_archive( 'product' ) ) { |
|
649 | - $query->set( 'posts_per_page', 4 ); |
|
650 | - } elseif ( ( $query === $wp_the_query ) && ( is_archive() ) && ( is_tax( 'story' ) ) ) { |
|
651 | - $query->set( 'posts_per_page', 3 ); |
|
648 | + if ($wp_the_query-> is_post_type_archive('product')) { |
|
649 | + $query->set('posts_per_page', 4); |
|
650 | + } elseif (($query === $wp_the_query) && (is_archive()) && (is_tax('story'))) { |
|
651 | + $query->set('posts_per_page', 3); |
|
652 | 652 | } |
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
656 | - add_action( 'pre_get_posts', 'strip_set_posts_per_page' ); |
|
656 | + add_action('pre_get_posts', 'strip_set_posts_per_page'); |
|
657 | 657 | |
658 | 658 | /** |
659 | 659 | * Show 'comics' post types on home page. |
660 | 660 | * |
661 | 661 | * @param string $query add_my_post_types_to_query. |
662 | 662 | */ |
663 | - function add_my_post_types_to_query( $query ) { |
|
664 | - if ( is_home() && $query->is_main_query() ) { |
|
665 | - $query->set( 'post_type', array( 'post', 'page', 'comic' ) ); |
|
663 | + function add_my_post_types_to_query($query) { |
|
664 | + if (is_home() && $query->is_main_query()) { |
|
665 | + $query->set('post_type', array('post', 'page', 'comic')); |
|
666 | 666 | |
667 | 667 | } |
668 | 668 | return $query; |
@@ -675,35 +675,35 @@ discard block |
||
675 | 675 | * @param string $post_id set_default_object_terms. |
676 | 676 | * @param string $post set_default_object_terms. |
677 | 677 | */ |
678 | - function set_default_object_terms( $post_id, $post ) { |
|
679 | - if ( 'publish' === $post->post_status && 'comic' === $post->post_type ) { |
|
678 | + function set_default_object_terms($post_id, $post) { |
|
679 | + if ('publish' === $post->post_status && 'comic' === $post->post_type) { |
|
680 | 680 | $defaults = array( |
681 | - 'story' => array( 'draft' ), |
|
681 | + 'story' => array('draft'), |
|
682 | 682 | ); |
683 | - $taxonomies = get_object_taxonomies( $post->post_type ); |
|
684 | - foreach ( (array) $taxonomies as $taxonomy ) { |
|
685 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
686 | - if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) { |
|
687 | - wp_set_object_terms( $post_id, $defaults[ $taxonomy ], $taxonomy ); |
|
683 | + $taxonomies = get_object_taxonomies($post->post_type); |
|
684 | + foreach ((array) $taxonomies as $taxonomy) { |
|
685 | + $terms = get_the_terms($post_id, $taxonomy); |
|
686 | + if (empty($terms) && array_key_exists($taxonomy, $defaults)) { |
|
687 | + wp_set_object_terms($post_id, $defaults[$taxonomy], $taxonomy); |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | } |
691 | 691 | } |
692 | - add_action( 'save_post', 'set_default_object_terms', 0, 2 ); |
|
692 | + add_action('save_post', 'set_default_object_terms', 0, 2); |
|
693 | 693 | |
694 | 694 | /** |
695 | 695 | * Remove jquery migrate $scripts for enhanced performance. |
696 | 696 | * |
697 | 697 | * @param strings $scripts remove_jquery_migrate. |
698 | 698 | */ |
699 | - function remove_jquery_migrate( $scripts ) { |
|
700 | - if ( is_admin() ) { |
|
699 | + function remove_jquery_migrate($scripts) { |
|
700 | + if (is_admin()) { |
|
701 | 701 | return; |
702 | 702 | } |
703 | - $scripts->remove( 'jquery' ); |
|
704 | - $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' ); |
|
703 | + $scripts->remove('jquery'); |
|
704 | + $scripts->add('jquery', false, array('jquery-core'), '1.10.2'); |
|
705 | 705 | } |
706 | - add_action( 'wp_default_scripts', 'remove_jquery_migrate' ); |
|
706 | + add_action('wp_default_scripts', 'remove_jquery_migrate'); |
|
707 | 707 | |
708 | 708 | /** |
709 | 709 | * Remove login errors notices (security) |
@@ -711,4 +711,4 @@ discard block |
||
711 | 711 | function no_wordpress_errors() { |
712 | 712 | return 'Something is wrong!'; |
713 | 713 | } |
714 | - add_filter( 'login_errors', 'no_wordpress_errors' ); |
|
714 | + add_filter('login_errors', 'no_wordpress_errors'); |