4.8 KiB
Roots Theme homepage | Documentation table of contents
Theme library
activation.php
This file handles the theme activation. About the theme activation.
cleanup.php
This file handles the various WordPress clean up. About the clean up.
config.php
This file is used to enable various theme features, define which pages get the sidebar, set the CSS classes for #main and #sidebar, set a Google Analytics ID, and set the post excerpt length.
Enable theme features
add_theme_support() is used to enable/disable:
- Root relative URLs
- Rewrites
- HTML5 Boilerplate's
.htaccess - Bootstrap's top navbar
If you don't want to use one of the features, either comment out the line or remove it.
Define which pages shouldn't have the sidebar
roots_sidebar() is used to define which pages shouldn't get the sidebar. By default, the 404 and page-custom.php template are full width. If you would like to remove the sidebar from additional pages, add in a proper conditional to the first if statement.
If you had a page named Contact, you would update the statement to look like:
if (is_404() || is_page_template('page-custom.php') || is_page('contact')) {
h5bp-htaccess
This file contains HTML5 Boilerplate's .htaccess which is automatically added by htaccess.php if enabled in config.php. There are a few changes to the H5BP version:
- Added block to access WordPress files that reveal version information (
wp-config.php,readme.html,license.txt) - Commented out expires headers (we recommend the use of W3 Total Cache)
- Commented out ETag removal (we recommend the use of W3 Total Cache)
- Commented out start rewrite engine (handled by WordPress)
- Commented out suppress/force www (handled by WordPress)
- Commented out
Options -MultiViews(causes a server 500 error on most shared hosts) - Commented out custom 404 page (handled by WordPress)
htaccess.php
This file handles the clean URL rewrites and HTML5 Boilerplate .htaccess. About the rewrites.
metaboxes.php
This file is a placeholder for you to put in custom metaboxes. We recommend the use of Custom Metaboxes and Fields for WordPress.
post-types.php
This file is a placeholder for you to put in custom post types and taxonomies.
scripts.php
This file handles all of the CSS and JavaScript.
Stylesheets
Stylesheets are enqueued in the following order:
/theme/assets/css/bootstrap.css/theme/assets/css/bootstrap-responsive.css/theme/assets/css/app.css/child-theme/style.css(if a child theme is activated)
app.css should be used for your site specific styling.
If you're using LESS, make sure you compile the files to the proper locations:
css/less/bootstrap.less->css/bootstrap.csscss/less/responsive.less->css/bootstrap-responsive.css
JavaScript
JavaScript is loaded in the following order:
/theme/assets/js/vendor/modernizr-2.6.1.min.js(inhead.php)jquery-1.8.0.min.jsvia Google CDN with local fallback (inhead.php)/theme/assets/js/plugins.js/theme/assets/js/main.js
jQuery is loaded in head.php using the same method from HTML5 Boilerplate: grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline. It's kept in the header instead of footer to avoid conflicts with plugins.
plugins.js contains a minified version of all the latest Bootstrap plugins.
Learn about plugins.js and main.js in the HTML5 Boilerplate JavaScript docs.
jQuery in the footer
It's safe to move jQuery to the footer if you're able to avoid problems with certain plugins that improperly use jQuery. Copy the necessary lines from head.php to footer.php right before wp_footer(), then update the wp_register_script() calls scripts.php to have scripts in the footer by setting the last argument to true.
utils.php
This file contains utility functions used by other files in the theme.
The theme wrapper is used to serve all of the template files. About the theme wrapper.
widgets.php
This file registers the custom sidebars and custom widgets. There are two initial sidebars:
- Primary Sidebar (used by
templates/sidebar.php, included frombase.phpwithin#sidebar) - Footer (used by
templates/footer.php)
The included vCard widget can be used to build additional, custom widgets.