Customisation

This section provides detailed information on how to customize your project settings using the package.json and settings.php files. The package.json file is primarily used for configuring various aspects of the project, including development server settings and webpack configurations. The settings.php file allows for additional customisations specific to your project needs.

Project Configuration (package.json)

Located packages/package.json

The package.json file is a crucial component of any Node.js project. It contains metadata about the project, including its dependencies, scripts, and various configuration options. Below are the configurable properties in the package.json file for this project.

  • Name
    themeDirectory
    Type
    string
    Description

    Specifies the root directory of the theme boilerplate. Defaults to cdrs.

  • Name
    localDomain
    Type
    string
    Description

    Defines the local domain used for development. This is the URL you will use to access your local development server. Defaults to https://boilerplate.local.

  • Name
    localPort
    Type
    integer
    Description

    Sets the local port for the development server. This is the port number on which your development server will run. Defaults to 3000.

  • Name
    maxAssetSize
    Type
    integer
    Description

    Specifies the maximum size (in bytes) for individual assets in your webpack configuration. This helps to ensure that your assets are not too large, which can negatively impact performance. For more details, see the webpack performance.maxAssetSize documentation. Defaults to 250000.

  • Name
    maxEntrypointSize
    Type
    integer
    Description

    Specifies the maximum size (in bytes) for entry points in your webpack configuration. This setting helps to control the size of your initial load bundles, ensuring they are optimized for performance. For more details, see the webpack performance.maxEntrypointSize documentation. Defaults to 250000.

Theme Settings (settings.php)

Located in inc/Settings.php

The settings.php file is a core settings file for the WordPress theme. It handles a multitude of configurations and customizations for your WordPress theme, making it a powerful tool for developers. Below is an overview of the various settings managed by this file:

  • Name
    theme_slug
    Type
    string
    Description

    Defines the theme's slug. Defaults to cdrs.

  • Name
    site_language
    Type
    string
    Description

    Sets the language for the site. Defaults to en-GB.

  • Name
    theme_color
    Type
    string
    Description

    Specifies the theme color. Defaults to #000.

  • Name
    critical_css
    Type
    boolean
    Description

    Enables or disables critical CSS. Defaults to true.

  • Name
    styles
    Type
    array
    Description

    An array to enqueue custom styles. Defaults to [].

  • Name
    scripts
    Type
    array
    Description

    An array to enqueue custom scripts. Defaults to [].

  • Name
    jquery
    Type
    object
    Description

    Contains settings for jQuery.

    • register: Option to register jQuery. Defaults to false.
    • conditions: Conditions for loading jQuery. Defaults to false.
  • Name
    preload_local_fonts
    Type
    array
    Description

    An array to preload local fonts. Defaults to [].

  • Name
    resource_hints
    Type
    array
    Description

    An array for resource hinting. Defaults to [].

  • Name
    images
    Type
    object
    Description

    Controls image settings.

    • add_sizes: Adds custom image sizes. Defaults to [].
    • remove_sizes: Removes default image sizes. Defaults to ['medium_large', '1536x1536', '2048x2048'].
    • disable_responsive: Disables responsive images. Defaults to true.
    • remove_wrapper_tags: Removes wrapper tags around images. Defaults to true.
    • lazyload: Enables lazy loading for images. Defaults to true.
  • Name
    posts
    Type
    boolean
    Description

    Controls post settings. Defaults to false.

  • Name
    remove_taxonomies
    Type
    object
    Description

    Removes specified taxonomies. Defaults to { 'category': 'post', 'post_tag': 'post' }.

  • Name
    disable_comments
    Type
    boolean
    Description

    Disables comments. Defaults to true.

  • Name
    acf
    Type
    object
    Description

    Contains settings for Advanced Custom Fields.

    • enable_modules: Enables specified ACF modules. Defaults to ['categories', 'scripts', 'performance'].
    • disable_modules: Disables specified ACF modules. Defaults to ['classic_editor', 'forms', 'options', 'options_pages', 'post_types', 'rewrite_rules', 'taxonomies', 'templates'].
    • performance_mode: Configures ACF performance mode.
      • engine: Defaults to hybrid.
      • options: Defaults to true.
      • ui: Defaults to false.
      • mode: Defaults to production.
    • accessible_button_field_key: Sets the accessible button field key. Defaults to field_6358fe1500d64.
  • Name
    editor
    Type
    object
    Description

    Contains settings for the editor.

    • disable_gutenberg: Disables the Gutenberg editor. Defaults to true.
    • post_revisions: Sets the number of post revisions. Defaults to 5.
    • add_formats: Adds custom formats. Defaults to [{ 'title': 'H3 Header', 'block': 'h3', 'classes': '' }].
    • remove_formats: Removes specified formats. Defaults to ['Paragraph=p', 'Heading 3=h3', 'Heading 4=h4', 'Heading 5=h5', 'Heading 6=h6'].
    • reformat: Customizes formatting options.
      • underline: Defaults to { 'inline': 'u' }.
      • strikethrough: Defaults to { 'inline': 's' }.
    • disable_emojis: Disables emojis. Defaults to true.
  • Name
    svg
    Type
    object
    Description

    Controls SVG uploads.

    • allow: Allows SVG uploads. Defaults to true.
    • roles: Specifies roles that can upload SVGs. Defaults to ['administrator', 'manager'].
  • Name
    admin
    Type
    object
    Description

    Contains settings for the admin and login.

    • show_admin_bar: Toggles the visibility of the admin bar. Defaults to false.
    • custom_admin_bar_links: Adds custom links to the admin bar. Defaults to [].
    • custom_login: Enables custom login styling. Defaults to true.
    • custom_admin: Enables custom admin styling. Defaults to true.
    • hide_version: Hides the WordPress version. Defaults to true.
    • remove_dashboard_meta: Removes specified dashboard meta boxes. Defaults to ['dashboard_incoming_links', 'dashboard_plugins', 'dashboard_primary', 'dashboard_secondary', 'dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_site_health'].
    • theme_functionality: Enables theme functionality such as post thumbnails. Defaults to ['post-thumbnails'].
    • file_editing: Enables or disables file editing. Defaults to true.
    • verify_admin_email: Toggles admin email verification. Defaults to false.
    • password_reset_notifications: Toggles password reset notifications. Defaults to false.
    • new_user_notifications: Toggles new user notifications. Defaults to false.
  • Name
    disable_auto_updates
    Type
    object
    Description

    Disables auto updates for core, plugins, and themes. Defaults to { 'core': true, 'plugins': true, 'themes': true }.

  • Name
    head_cleanup
    Type
    object
    Description

    Cleans up head assets and tags. Defaults to { 'assets': true, 'tags': true }.

  • Name
    disable_rest_api
    Type
    boolean
    Description

    Toggles the REST API. Defaults to false.

  • Name
    disable_rss
    Type
    boolean
    Description

    Disables RSS feeds. Defaults to true.

  • Name
    component_classes
    Type
    array
    Description

    Sets default component classes. Defaults to ['u-default'].

  • Name
    maintenance_mode
    Type
    object
    Description

    Enables or disables maintenance mode and sets the maintenance message.

    • enable: Defaults to false.
    • message: Defaults to 'This website is currently undergoing scheduled maintenance. Please try again later.'.
  • Name
    include
    Type
    object
    Description

    Includes custom files and directories.

    • files: Defaults to ['Utils'].
    • directories: Defaults to ['Functions'].

This file provides a comprehensive set of options to customise and optimise your WordPress theme, ensuring it meets your specific needs and requirements.