Skip to main content

Globals Reference

Below is an overview of options contained within njk/templates/_globals-defaults.html. Prior to generating a custom build of the theme, copy this file to njk/templates/_globals.html and make revisions as neccessary.


Theme Information#

Options in this section are primarily used to generate the style.css file. However, some options, such as the version number, are used across the theme.

  • theme_name
    (string) The name of your theme, which will be displayed on the Themes page in the WordPress dashboard.
    Default: "Method"

  • theme_uri
    (string) A url for a website that contains information about your theme.
    Default: "https://github.com/pixelwatt/method"

  • theme_description
    (string) A description for your theme, which will be displayed on the Themes page in the WordPress dashboard.
    Default: "A barebones foundation for custom theme development."

  • theme_version
    (string) The version number for your theme. In most cases, you'll want to change this to "1.0.0" or an initial development release number.
    Default: "1.3.1"

  • theme_author
    (string) The author of your theme, which will be displayed on the Themes page in the WordPress dashboard.
    Default: "Rob Clark"

  • theme_author_uri
    (string) The url for the author of your theme. If provided, the author's name will be linked to this url in the WordPress dashboard.
    Default: "https://robclark.io/"

  • theme_tags
    (string) A comma-seperated list of tags that are relevant to your theme, which will be displayed on the Themes page in the WordPress dashboard if provided.
    Default: "cmb2, bootstrap"

  • github_theme_uri
    (bool|string) If you would like to use the GitHub Updater plugin to deploy updates for this theme, provide the neccessary url here. Otherwise, set as false.
    Default: false


Theme Support#

Options in this section determine whether or not your theme enables support for select WordPress features.

  • theme_support_html5
    (bool) Whether or not WordPress should use HTML5 markup for the search forms, comment forms, comment lists, gallery, and caption (when using WordPress-provided components). Default: true

  • theme_support_titletag
    (bool) Whether or not to allow plugins and themes to manage the document title tag.
    Default: true

  • theme_support_thumbnails
    (bool) Whether or not to support Featured Images for individual posts.
    Default: true


Nav Menus#

In this section, you'll provide the needed information to register nav menu locations for your theme.

  • nav_menus
    (array) An array of nav menu location names and labels.
    Default: [{ label: "Primary", location: "primary" }]

Custom Image Sizes#

In this section, you'll provide the needed information to register custom image sizes for your theme.

  • image_sizes
    (array) An array of custom image size names, dimensions, and whether or not resized images for the size should be cropped.
    Default: [{ name: "header_bg", width: 1400, height: 600, cropped: true }]

Required Plugins#

In this section, you'll choose whether or not to require the installation of certain plugins upon theme activation.

  • require_cmb2
    (bool) Whether or not to require the CMB2 plugin. It is highly recommended to keep this set as true.
    Default: true

  • require_classic_editor
    (bool) Whether or not to require the Classic Editor plugin, which will disable the Gutenberg editor.
    Default: false

  • require_github_updater
    (bool) Whether or not to require the GitHub Updater plugin.
    Default: false

  • require_cmb2_roadway_segments
    (bool) Whether or not to require the CMB2 Roadway Segments plugin, which adds a custom CMB2 field type for Google Maps.
    Default: false

  • require_cmb2_mapbox
    (bool) Whether or not to require the CMB2 Mapbox plugin, which adds a custom CMB2 field type for Mapbox.
    Default: false


Code#

Options in this section determine how functions and classes are named, as well as which text domain to use where applicable.

  • code_textdomain
    (string) The text domain for the theme.
    Default: "method"

  • code_prefix
    (string) The prefix to use for all function names and any references to those functions.
    Default: "method_"

  • code_layoutclass
    (string) The name to use for the theme's layout class that extends MethodLayout.
    Default: "MethodThemeLayout"


Javascript Libraries#

Options in this section which scripts to include in the theme's scripts gulp task. Please note that you'll need to install dev dependencies and run gulp scripts for any of the options below to be reflected, or for any of the bundled Javascript libraries to work in general.

  • js_use_matchheight
    (bool) Whether or not jQuery matchHeight should be included in the theme's combined scripts file.
    Default: true

  • js_use_jarallax
    (bool) Whether or not Jarallax should be included in the theme's combined scripts file.
    Default: true


Common CSS Classes#

In this section, you'll provide common CSS classes that you'd like to be made available via the method_get_class() function.

  • css_classes
    (array) An array of css classes and the ID to refrence them by when using the themeget_class() function.
    _Default: [{ id: "full_width_outer_col", class: "full-width-outer-col col-12 col-sm-11" },{ id: "full_width_container", class: "full-width-container" }]

Local Development#

  • localdev_url
    (string) The functional local dev URL that you plan to use for viewing this theme's dev site. When running gulp serve from the theme's directory, BrowserSync will use this address as a proxy.
    Default: "method.test:8080"

Other#

  • jquery_version
    (string) Because WordPress now ships with a modern version of jQuery, it is highly recommended that you leave this option blank. If you would like to use a custom version of jQuery, enter the version number here to deregister the built-in version for the frontend and reregister the replacement version using Google's CDN.
    Default: ""

  • googlefonts_css_url
    (string) If using fonts from Google Fonts, enter the provided URL here. If this option is not empty, a wpenqueue_style() call be generated to correctly enqueue the script, using a null version number to prevent a broken url.
    _Default: ""

  • fontawesome_kit_url
    (string) While Bootstrap Icons tend to be faster, especially when inlined, providing a FontAwesome kit url will generate a wpenqueue_script() to correctly enqueue the FontAwesome kit.
    _Default: ""


Login Customization#

Options in this section allow you to customize the appearance of the theme's login page. Aside from the first option, all options in this section will be used to generate the login.css file.

  • custom_login_enable
    (bool) Whether or not to add the neccessary lines to admin-customization.php to enable a customized login screen. If set to false, there's no need to change any of the other variables in this section.
    Default: true

  • custom_login_accent
    (string) The accent color for the login screen. This will be used as the background color for buttons and alerts, as well as the text color for links below the login form.
    Default: "#4BFD9F"

  • custom_login_btn_color
    (string) The text color for buttons and alerts that appear on the login screen. This color should have sufficient contrast with the color set for custom_login_accent
    Default: "#000"

  • custom_login_logo
    (string) The relative path from the theme's root folder for the custom logo to display in the place of the WordPress logo on the login page.
    Default: "assets/images/login-logo.svg"

  • custom_login_logo_width
    (string) The display width of the logo.
    Default: "250px"

  • custom_login_logo_height
    (string) The display height of the logo.
    Default: "80px"

  • custom_login_bg
    (string) The relative path from the theme's root folder for the custom background image to display as the background behind the login form on the login page.
    Default: "assets/images/login-bg.jpg"