Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

This branch is 0 commits ahead and 0 commits behind parent

Octocat-spinner-32 assets Updated app.less version August 25, 2013
Octocat-spinner-32 doc Merge branch 'master' of git://github.com/roots/roots into parent August 25, 2013
Octocat-spinner-32 lang hungarian lang update August 16, 2013
Octocat-spinner-32 lib Merge branch 'master' of git://github.com/roots/roots into parent August 25, 2013
Octocat-spinner-32 tasks Fix names for enqueued CSS/JS February 28, 2013
Octocat-spinner-32 templates Merge branch 'master' of git://github.com/roots/roots into parent August 25, 2013
Octocat-spinner-32 .editorconfig Add EditorConfig February 08, 2013
Octocat-spinner-32 .gitignore Add support for grunt 0.4.0 February 22, 2013
Octocat-spinner-32 .gitmodules implement Theme Hook Alliance May 09, 2013
Octocat-spinner-32 .jshintrc Fixed error with jshint's ES5 option August 24, 2013
Octocat-spinner-32 404.php Simplify alerts February 12, 2013
Octocat-spinner-32 CHANGELOG.md Roots 6.5.0 August 22, 2013
Octocat-spinner-32 CONTRIBUTING.md
Octocat-spinner-32 Gruntfile.js Roots 6.5.0 August 22, 2013
Octocat-spinner-32 LICENSE.md Remove year from copyright January 13, 2013
Octocat-spinner-32 README.md contribute documentation add August 01, 2013
Octocat-spinner-32 base.php Merge branch 'master' of git://github.com/retlehs/roots into parent July 22, 2013
Octocat-spinner-32 composer.json composer.json add August 25, 2013
Octocat-spinner-32 functions.php Merge branch 'master' of git://github.com/retlehs/roots into parent July 22, 2013
Octocat-spinner-32 index.php Fix #720 - Re-organize archives template March 24, 2013
Octocat-spinner-32 package.json Roots 6.5.0 August 22, 2013
Octocat-spinner-32 page.php Add theme wrapper, re-organize template files August 18, 2012
Octocat-spinner-32 screenshot.png Add new logo by Jens Windolf May 01, 2013
Octocat-spinner-32 single.php Add theme wrapper, re-organize template files August 18, 2012
Octocat-spinner-32 style.css Roots 6.5.0 August 22, 2013
Octocat-spinner-32 template-custom.php Rename page-custom.php to template-custom.php April 30, 2013
README.md

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 );
}

Tips

  • 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.

Reference

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]
</IfModule>

# END WordPress

Contributing

Screencast

Something went wrong with that request. Please try again.