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