Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
{ "branches": { "parent": "child rewrites, hooks", "templating": "some examples" } }

This branch is 14 commits ahead, 570 commits behind roots:master

Failed to load latest commit information.
assets Updated app.less version
doc/assets/img Merge branch 'master' of git:// into parent
lang hungarian lang update
lib Merge branch 'master' of git:// into parent
tasks Fix names for enqueued CSS/JS
templates Merge branch 'master' of git:// into parent
.editorconfig Add EditorConfig
.gitignore Add support for grunt 0.4.0
.gitmodules implement Theme Hook Alliance
.jshintrc Fixed error with jshint's ES5 option
404.php Simplify alerts Roots 6.5.0 Roots 6.5.0
Gruntfile.js Roots 6.5.0 Remove year from copyright contribute documentation add
base.php Merge branch 'master' of git:// into parent
composer.json composer.json add
functions.php Merge branch 'master' of git:// into parent
index.php Fix #720 - Re-organize archives template
package.json Roots 6.5.0
page.php Add theme wrapper, re-organize template files
screenshot.png Add new logo by Jens Windolf
single.php Add theme wrapper, re-organize template files
style.css Roots 6.5.0
template-custom.php Rename page-custom.php to template-custom.php

Roots Theme — Parent

Proof of concept using Roots Theme as a parent theme without removing theme support for root-relative-urls or rewrites. Also implements Theme Hook Alliance.

Theme Hook Alliance

You must initialize the submodule: git submodule init && git submodule update.

Example Code

Example code for your child's functions.php

Common enqueues/dequeues:

add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 101 );
function my_enqueue_scripts() {
  // dequeue style.css
  wp_dequeue_style( 'roots_child' );

  // enqueue child_plugins.js
  wp_enqueue_script( 'my_child_plugins',
    trailingslashit( get_stylesheet_directory_uri() ) . 'assets/js/child_plugins.js', array(), false );

  // enqueue main.js with custom dependencies
  wp_dequeue_script( 'roots_main' );
  wp_enqueue_script( 'my_main',
    trailingslashit( get_stylesheet_directory_uri() ) . 'assets/js/main.js', array( 'jquery', 'my_child_plugins' ), false );


  • Copy lib/config.php to lib/config.php in the root of your child theme. Now you have full control over sidebar display, generated classes and other configurations from the child.
  • If permalinks/rewrites are working and being used, assets in the child will successfully override parent assets. If rewrites aren't activated, the child assets must be explicitly registered, and the parents unregistered. To test the override, create assets/js/main.js or assets/css/app.css in the child; it should get included instead of the parent version of the same file.


This is what your .htaccess would look like using roots-simple-child:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{DOCUMENT_ROOT}/app/themes/roots-simple-child/$1 -f
RewriteRule ^(.*[^/])/?$ /app/themes/roots-simple-child/$1 [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/app/themes/roots/$1 -f
RewriteRule ^(.*[^/])/?$ /app/themes/roots/$1 [QSA,L]
RewriteRule ^plugins/(.*) /app/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress



Something went wrong with that request. Please try again.