Conditions | 1 |
Paths | 1 |
Total Lines | 71 |
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 |
||
15 | function initTheme() |
||
16 | { |
||
17 | // initialize plugin defaults |
||
18 | Flynt\initDefaults(); |
||
19 | |||
20 | // Set to true to load all assets from a CDN if there is one specified |
||
21 | Asset::loadFromCdn(false); |
||
22 | |||
23 | // register all components in 'Components' folder |
||
24 | add_theme_support('flynt-components', get_template_directory() . '/dist/Components/'); |
||
25 | |||
26 | // register all custom post types |
||
27 | add_theme_support('flynt-custom-post-types', [ |
||
28 | 'dir' => get_template_directory() . '/config/customPostTypes/', |
||
29 | 'fileName' => 'config.json' |
||
30 | ]); |
||
31 | |||
32 | // register all custom taxonomies |
||
33 | add_theme_support('flynt-custom-taxonomies', [ |
||
34 | 'dir' => get_template_directory() . '/config/customTaxonomies/' |
||
35 | ]); |
||
36 | |||
37 | // initialize ACF Field Groups and Option Pages |
||
38 | add_theme_support('flynt-acf', [ |
||
39 | 'FieldLoader', |
||
40 | 'FieldGroupComposer', |
||
41 | 'OptionPages', |
||
42 | 'FlexibleContentToggle', |
||
43 | 'GoogleMaps' |
||
44 | ]); |
||
45 | |||
46 | // enable admin notices |
||
47 | add_theme_support('flynt-admin-notices'); |
||
48 | |||
49 | // set correct config dir (+ more?) |
||
50 | add_theme_support('flynt-templates'); |
||
51 | |||
52 | // use timber rendering |
||
53 | add_theme_support('flynt-timber-loader'); |
||
54 | |||
55 | // load jQuery in footer by default |
||
56 | add_theme_support('flynt-jquery'); |
||
57 | |||
58 | // clean up some things |
||
59 | add_theme_support('flynt-clean-head'); |
||
60 | add_theme_support('flynt-clean-rss'); |
||
61 | add_theme_support('flynt-mime-types'); |
||
62 | add_theme_support('flynt-navigation'); |
||
63 | add_theme_support('flynt-remove-editor'); |
||
64 | add_theme_support('flynt-tiny-mce'); |
||
65 | |||
66 | // add components previews |
||
67 | add_theme_support('flynt-admin-component-preview'); |
||
68 | |||
69 | // google analytics |
||
70 | add_theme_support('flynt-google-analytics'); |
||
71 | |||
72 | // hide protected posts |
||
73 | add_theme_support('flynt-hide-protected-posts'); |
||
74 | |||
75 | // WP Stuff |
||
76 | add_theme_support('title-tag'); |
||
77 | add_theme_support('post-thumbnails'); |
||
78 | |||
79 | add_theme_support('flynt-password-form'); |
||
80 | add_theme_support('flynt-external-script-loader'); |
||
81 | add_theme_support('flynt-lodash'); |
||
82 | |||
83 | // enable flynt log server |
||
84 | add_theme_support('flynt-component-log-server'); |
||
85 | } |
||
86 | add_action('after_setup_theme', __NAMESPACE__ . '\\initTheme'); |
||
112 |