| Conditions | 1 |
| Paths | 1 |
| Total Lines | 113 |
| 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 |
||
| 25 | function spurs_setup() { |
||
| 26 | /* |
||
| 27 | * Make theme available for translation. |
||
| 28 | * Translations can be filed in the /languages/ directory. |
||
| 29 | * If you're building a theme based on Spurs, use a find and replace |
||
| 30 | * to change 'spurs' to the name of your theme in all the template files |
||
| 31 | */ |
||
| 32 | load_theme_textdomain( 'spurs', get_template_directory() . '/languages' ); |
||
| 33 | |||
| 34 | // Add default posts and comments RSS feed links to head. |
||
| 35 | add_theme_support( 'automatic-feed-links' ); |
||
| 36 | |||
| 37 | /* |
||
| 38 | * Let WordPress manage the document title. |
||
| 39 | * By adding theme support, we declare that this theme does not use a |
||
| 40 | * hard-coded <title> tag in the document head, and expect WordPress to |
||
| 41 | * provide it for us. |
||
| 42 | */ |
||
| 43 | add_theme_support( 'title-tag' ); |
||
| 44 | |||
| 45 | // This theme uses wp_nav_menu() in one location. |
||
| 46 | register_nav_menus( array( |
||
| 47 | 'primary' => __( 'Primary Menu', 'spurs' ), |
||
| 48 | ) ); |
||
| 49 | |||
| 50 | /* |
||
| 51 | * Switch default core markup for search form, comment form, and comments |
||
| 52 | * to output valid HTML5. |
||
| 53 | */ |
||
| 54 | add_theme_support( 'html5', array( |
||
| 55 | 'search-form', |
||
| 56 | 'comment-form', |
||
| 57 | 'comment-list', |
||
| 58 | 'gallery', |
||
| 59 | 'caption', |
||
| 60 | ) ); |
||
| 61 | |||
| 62 | /* |
||
| 63 | * Adding Thumbnail basic support |
||
| 64 | */ |
||
| 65 | add_theme_support( 'post-thumbnails' ); |
||
| 66 | |||
| 67 | /* |
||
| 68 | * Adding support for Widget edit icons in customizer |
||
| 69 | */ |
||
| 70 | add_theme_support( 'customize-selective-refresh-widgets' ); |
||
| 71 | |||
| 72 | /* |
||
| 73 | * Enable support for Post Formats. |
||
| 74 | * See http://codex.wordpress.org/Post_Formats |
||
| 75 | */ |
||
| 76 | add_theme_support( 'post-formats', array( |
||
| 77 | 'aside', |
||
| 78 | 'image', |
||
| 79 | 'video', |
||
| 80 | 'quote', |
||
| 81 | 'link', |
||
| 82 | ) ); |
||
| 83 | |||
| 84 | // Set up the WordPress core custom background feature. |
||
| 85 | add_theme_support( 'custom-background', apply_filters( 'spurs_custom_background_args', array( |
||
| 86 | 'default-color' => 'ffffff', |
||
| 87 | 'default-image' => '', |
||
| 88 | ) ) ); |
||
| 89 | |||
| 90 | // Set up the WordPress Theme logo feature. |
||
| 91 | add_theme_support( 'custom-logo' ); |
||
| 92 | |||
| 93 | // Add support for responsive embedded content. |
||
| 94 | add_theme_support( 'responsive-embeds' ); |
||
| 95 | |||
| 96 | // Add support for default styles. |
||
| 97 | add_theme_support( 'wp-block-styles' ); |
||
| 98 | |||
| 99 | // Add support for full width blocks. |
||
| 100 | add_theme_support( 'align-wide' ); |
||
| 101 | |||
| 102 | // Check and setup theme default settings. |
||
| 103 | spurs_setup_theme_default_settings(); |
||
| 104 | |||
| 105 | // Adds brand colors to Blocks color palette. |
||
| 106 | add_theme_support( 'editor-color-palette', array( |
||
| 107 | array( |
||
| 108 | 'name' => __( 'Green', 'spurs' ), |
||
| 109 | 'slug' => 'green', |
||
| 110 | 'color' => '#6aaf08', |
||
| 111 | ), |
||
| 112 | array( |
||
| 113 | 'name' => __( 'Dark Green', 'spurs' ), |
||
| 114 | 'slug' => 'dark-green', |
||
| 115 | 'color' => '#548a06', |
||
| 116 | ), |
||
| 117 | array( |
||
| 118 | 'name' => __( 'Blue', 'spurs' ), |
||
| 119 | 'slug' => 'blue', |
||
| 120 | 'color' => '#007ac3', |
||
| 121 | ), |
||
| 122 | array( |
||
| 123 | 'name' => __( 'Black', 'spurs' ), |
||
| 124 | 'slug' => 'black', |
||
| 125 | 'color' => '#2b2b2b', |
||
| 126 | ), |
||
| 127 | array( |
||
| 128 | 'name' => __( 'White', 'spurs' ), |
||
| 129 | 'slug' => 'white', |
||
| 130 | 'color' => '#FFFFFF', |
||
| 131 | ), |
||
| 132 | |||
| 133 | ) ); |
||
| 134 | |||
| 135 | // Hard cropped featured images |
||
| 136 | //add_image_size( 'featured-rounded', 230, 230, true ); |
||
| 137 | } |
||
| 138 | } // spurs_setup. |
||
| 169 | } |