| Conditions | 1 |
| Paths | 1 |
| Total Lines | 88 |
| Code Lines | 33 |
| 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 |
||
| 36 | function bitsy_setup() { |
||
| 37 | /* |
||
| 38 | * Make theme available for translation. |
||
| 39 | * Translations can be filed in the /languages/ directory. |
||
| 40 | * If you're building a theme based on bitsy, use a find and replace |
||
| 41 | * to change 'bitsy' to the name of your theme in all the template files. |
||
| 42 | */ |
||
| 43 | load_theme_textdomain( 'bitsy', get_template_directory() . '/languages' ); |
||
| 44 | |||
| 45 | // Add default posts and comments RSS feed links to head. |
||
| 46 | add_theme_support( 'automatic-feed-links' ); |
||
| 47 | |||
| 48 | /* |
||
| 49 | * Let WordPress manage the document title. |
||
| 50 | * By adding theme support, we declare that this theme does not use a |
||
| 51 | * hard-coded <title> tag in the document head, and expect WordPress to |
||
| 52 | * provide it for us. |
||
| 53 | */ |
||
| 54 | add_theme_support( 'title-tag' ); |
||
| 55 | |||
| 56 | /* |
||
| 57 | * Enable support for Post Thumbnails on posts and pages. |
||
| 58 | * |
||
| 59 | * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ |
||
| 60 | */ |
||
| 61 | add_theme_support( 'post-thumbnails' ); |
||
| 62 | |||
| 63 | // This theme uses wp_nav_menu() in one location. |
||
| 64 | register_nav_menus( array( |
||
| 65 | 'primary' => esc_html__( 'Primary', 'bitsy' ), |
||
| 66 | 'social' => __( 'Social Links Menu', 'bitsy' ) |
||
| 67 | ) ); |
||
| 68 | |||
| 69 | /* |
||
| 70 | * Switch default core markup for search form, comment form, and comments |
||
| 71 | * to output valid HTML5. |
||
| 72 | */ |
||
| 73 | add_theme_support( 'html5', array( |
||
| 74 | 'search-form', |
||
| 75 | 'comment-form', |
||
| 76 | 'comment-list', |
||
| 77 | 'gallery', |
||
| 78 | 'caption', |
||
| 79 | ) ); |
||
| 80 | |||
| 81 | // Set up the WordPress core custom background feature. |
||
| 82 | add_theme_support( 'custom-background', apply_filters( 'bitsy_custom_background_args', array( |
||
| 83 | 'default-color' => 'ffffff', |
||
| 84 | 'default-image' => '', |
||
| 85 | ) ) ); |
||
| 86 | |||
| 87 | /* |
||
| 88 | * Enable support for Post Formats. |
||
| 89 | * |
||
| 90 | * See: https://codex.wordpress.org/Post_Formats |
||
| 91 | */ |
||
| 92 | add_theme_support( 'post-formats', array( |
||
| 93 | 'aside', |
||
| 94 | 'image', |
||
| 95 | 'video', |
||
| 96 | 'quote', |
||
| 97 | 'link', |
||
| 98 | 'gallery', |
||
| 99 | 'status', |
||
| 100 | 'audio', |
||
| 101 | 'chat', |
||
| 102 | ) ); |
||
| 103 | /* |
||
| 104 | * This theme styles the visual editor to resemble the theme style, |
||
| 105 | * specifically font, colors, icons, and column width. |
||
| 106 | */ |
||
| 107 | //add_editor_style( array( 'css/editor-style.css', bitsy_fonts_url() ) ); |
||
| 108 | |||
| 109 | // Add theme support for selective refresh for widgets. |
||
| 110 | add_theme_support( 'customize-selective-refresh-widgets' ); |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Add support for core custom logo. |
||
| 114 | * |
||
| 115 | * @link https://codex.wordpress.org/Theme_Logo |
||
| 116 | */ |
||
| 117 | add_theme_support( 'custom-logo', array( |
||
| 118 | 'height' => 250, |
||
| 119 | 'width' => 250, |
||
| 120 | 'flex-width' => true, |
||
| 121 | 'flex-height' => true, |
||
| 122 | ) ); |
||
| 123 | } |
||
| 124 | } // bitsy_setup |
||
| 178 |