| Conditions | 5 |
| Paths | 4 |
| Total Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 10 | function podium_scripts() |
||
| 11 | { |
||
| 12 | |||
| 13 | if (WP_ENV === 'production') { |
||
| 14 | wp_enqueue_style( |
||
| 15 | 'podium-style', |
||
| 16 | get_stylesheet_directory_uri() . '/dist/styles/main.min.css', |
||
| 17 | false, |
||
| 18 | null |
||
| 19 | ); |
||
| 20 | wp_enqueue_script( |
||
| 21 | 'podium-scripts', |
||
| 22 | get_stylesheet_directory_uri() . '/dist/scripts/main.min.js', |
||
| 23 | null, |
||
| 24 | null, |
||
| 25 | true |
||
| 26 | ); |
||
| 27 | } else { |
||
| 28 | wp_enqueue_style( |
||
| 29 | 'podium-style', |
||
| 30 | get_stylesheet_directory_uri() . '/dist/styles/main.css', |
||
| 31 | false, |
||
| 32 | null |
||
| 33 | ); |
||
| 34 | wp_enqueue_script( |
||
| 35 | 'podium-scripts', |
||
| 36 | get_stylesheet_directory_uri() . '/dist/scripts/main.js', |
||
| 37 | null, |
||
| 38 | null, |
||
| 39 | true |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | // Add resources for individual page templates |
||
| 44 | // if (is_page_template('page-contact.php')) { |
||
| 45 | |||
| 46 | // wp_enqueue_script( |
||
| 47 | // 'contact-page-script', |
||
| 48 | // get_stylesheet_directory_uri() . '/dist/scripts/contact-page.js', |
||
| 49 | // ['jquery'], |
||
| 50 | // false, |
||
| 51 | // true |
||
| 52 | // ); |
||
| 53 | // wp_enqueue_script( |
||
| 54 | // 'google-recapcha-script', |
||
| 55 | // '//www.google.com/recaptcha/api.js?hl='.pll_current_language(), |
||
| 56 | // ['contact-page-script'], |
||
| 57 | // false, |
||
| 58 | // true |
||
| 59 | // ); |
||
| 60 | |||
| 61 | // } |
||
| 62 | |||
| 63 | //remove emoji scripts |
||
| 64 | remove_action('wp_head', 'print_emoji_detection_script', 7); |
||
| 65 | remove_action('admin_print_scripts', 'print_emoji_detection_script'); |
||
| 66 | remove_action('wp_print_styles', 'print_emoji_styles'); |
||
| 67 | remove_action('admin_print_styles', 'print_emoji_styles'); |
||
| 68 | |||
| 69 | if (is_singular() && comments_open() && get_option('thread_comments')) { |
||
| 70 | wp_enqueue_script('comment-reply'); |
||
| 71 | } |
||
| 72 | |||
| 73 | } |
||
| 74 | |||
| 136 |