| Conditions | 1 |
| Paths | 1 |
| Total Lines | 121 |
| Code Lines | 90 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 33 | function theme_support() { |
||
| 34 | // Add support for editor styles. |
||
| 35 | add_theme_support( 'editor-styles' ); |
||
| 36 | // Add support for full and wide align images. |
||
| 37 | add_theme_support( 'align-wide' ); |
||
| 38 | // Add support for styling blocks. |
||
| 39 | add_theme_support( 'wp-block-styles' ); |
||
| 40 | // Add support for responsive embedded content. |
||
| 41 | add_theme_support( 'responsive-embeds' ); |
||
| 42 | // Add support for Custom Line Heights. |
||
| 43 | add_theme_support( 'custom-line-height' ); |
||
| 44 | // Add support for Custom Units. |
||
| 45 | add_theme_support( 'custom-units' ); |
||
| 46 | // Add custom editor font sizes. |
||
| 47 | add_theme_support( |
||
| 48 | 'editor-font-sizes', |
||
| 49 | array( |
||
| 50 | array( |
||
| 51 | 'name' => esc_html_x( 'Small', 'font size option label', 'lsx' ), |
||
| 52 | 'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ), |
||
| 53 | 'size' => 13, |
||
| 54 | 'slug' => 'small', |
||
| 55 | ), |
||
| 56 | array( |
||
| 57 | 'name' => esc_html_x( 'Normal', 'font size option label', 'lsx' ), |
||
| 58 | 'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ), |
||
| 59 | 'size' => 15, |
||
| 60 | 'slug' => 'normal', |
||
| 61 | ), |
||
| 62 | array( |
||
| 63 | 'name' => esc_html_x( 'Medium', 'font size option label', 'lsx' ), |
||
| 64 | 'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ), |
||
| 65 | 'size' => 22, |
||
| 66 | 'slug' => 'medium', |
||
| 67 | ), |
||
| 68 | array( |
||
| 69 | 'name' => esc_html_x( 'Large', 'font size option label', 'lsx' ), |
||
| 70 | 'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ), |
||
| 71 | 'size' => 30, |
||
| 72 | 'slug' => 'large', |
||
| 73 | ), |
||
| 74 | array( |
||
| 75 | 'name' => esc_html_x( 'Huge', 'font size option label', 'lsx' ), |
||
| 76 | 'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ), |
||
| 77 | 'size' => 40, |
||
| 78 | 'slug' => 'huge', |
||
| 79 | ), |
||
| 80 | ) |
||
| 81 | ); |
||
| 82 | |||
| 83 | // Add support for custom color scheme. |
||
| 84 | add_theme_support( 'editor-color-palette', array( |
||
| 85 | array( |
||
| 86 | 'name' => __( 'Strong Blue', 'lsx' ), |
||
| 87 | 'slug' => 'strong-blue', |
||
| 88 | 'color' => '#27639e', |
||
| 89 | ), |
||
| 90 | array( |
||
| 91 | 'name' => __( 'Lighter Blue', 'lsx' ), |
||
| 92 | 'slug' => 'lighter-blue', |
||
| 93 | 'color' => '#428bca', |
||
| 94 | ), |
||
| 95 | array( |
||
| 96 | 'name' => __( 'Yellow', 'lsx' ), |
||
| 97 | 'slug' => 'light-yellow', |
||
| 98 | 'color' => '#f7ae00', |
||
| 99 | ), |
||
| 100 | array( |
||
| 101 | 'name' => __( 'Dark Yellow', 'lsx' ), |
||
| 102 | 'slug' => 'dark-yellow', |
||
| 103 | 'color' => '#ab7800', |
||
| 104 | ), |
||
| 105 | array( |
||
| 106 | 'name' => __( 'Green', 'lsx' ), |
||
| 107 | 'slug' => 'light-green', |
||
| 108 | 'color' => '#6BA913', |
||
| 109 | ), |
||
| 110 | array( |
||
| 111 | 'name' => __( 'Dark Green', 'lsx' ), |
||
| 112 | 'slug' => 'dark-green', |
||
| 113 | 'color' => '#3F640B', |
||
| 114 | ), |
||
| 115 | array( |
||
| 116 | 'name' => __( 'White', 'lsx' ), |
||
| 117 | 'slug' => 'white', |
||
| 118 | 'color' => '#ffffff', |
||
| 119 | ), |
||
| 120 | array( |
||
| 121 | 'name' => __( 'Black', 'lsx' ), |
||
| 122 | 'slug' => 'black', |
||
| 123 | 'color' => '#000000', |
||
| 124 | ), |
||
| 125 | ) ); |
||
| 126 | |||
| 127 | $primary_color = 'rgba(39,99,158,1)'; |
||
| 128 | $secondary_color = 'rgba(247,174,0,1)'; |
||
| 129 | $tertiary_color = 'rgba(107,169,19,1)'; |
||
| 130 | $background_color = 'rgba(249,249,249,1)'; |
||
| 131 | |||
| 132 | add_theme_support( |
||
| 133 | 'editor-gradient-presets', |
||
| 134 | array( |
||
| 135 | array( |
||
| 136 | 'name' => __( 'Primary to Secondary', 'lsx' ), |
||
| 137 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)', |
||
| 138 | 'slug' => 'primary-to-secondary', |
||
| 139 | ), |
||
| 140 | array( |
||
| 141 | 'name' => __( 'Primary to Tertiary', 'lsx' ), |
||
| 142 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
||
| 143 | 'slug' => 'primary-to-tertiary', |
||
| 144 | ), |
||
| 145 | array( |
||
| 146 | 'name' => __( 'Primary to Background', 'lsx' ), |
||
| 147 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)', |
||
| 148 | 'slug' => 'primary-to-background', |
||
| 149 | ), |
||
| 150 | array( |
||
| 151 | 'name' => __( 'Secondary to Tertiary', 'lsx' ), |
||
| 152 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
||
| 153 | 'slug' => 'secondary-to-tertiary', |
||
| 154 | ), |
||
| 172 |