Setup
Barebones keeps core WordPress theme setup in includes/setup.php.
This file enables common theme features, loads the text domain and cleans up some unused default WordPress output.
Theme setup file
The setup file is loaded from functions.php.
require_once get_template_directory() . '/includes/setup.php';The main setup callback runs on after_setup_theme.
add_action( 'after_setup_theme', 'theme_setup' );Theme support
Barebones enables a small set of WordPress theme features.
These enable:
- editor styles
- WordPress block styles
- automatic document title output
- featured images
add_theme_support( 'editor-styles' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );Image support
Featured image support is enabled with post-thumbnails.
add_theme_support( 'post-thumbnails' );Custom image sizes can be added in the same setup function. Add image sizes based on the project’s design and content requirements.
add_image_size( 'custom-size', 700, 200, true );Text domain
Barebones loads the barebones text domain. Use this text domain for translatable strings.
load_theme_textdomain( 'barebones', get_template_directory() . '/languages' );__( 'Read more', 'barebones' );Admin bar
The frontend admin bar is hidden by default to prevent layout shift. Remove this filter if the project should show the admin bar for logged-in users.
add_filter( 'show_admin_bar', '__return_false' );Head cleanup
Barebones removes several default WordPress tags and scripts from the document head. Head cleanup
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );Comment feed link
The comments feed link is disabled. This is useful for projects like brochure sites where comments are not part of the content model.
add_filter( 'post_comments_feed_link', '__return_false' );Embed script
The default WordPress embed script is deregistered on the frontend. Remove this if the project relies on WordPress embed behaviour.
function deregister_scripts() {
wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_enqueue_scripts', 'deregister_scripts', 100 );Project functions
Project-specific PHP can be added to includes/custom.php.
This file is loaded by functions.php and is intended for custom functions that do not belong in one of the more specific include files.