Genesis Theme Toolkit

Building blocks to develop a config-based Genesis Framework child theme for WordPress.
Alternatives To Genesis Theme Toolkit
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Sage12,107634 days ago40July 19, 202213mitPHP
WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
Timber5,209131777 days ago115June 22, 2022209mitPHP
Create WordPress themes with beautiful OOP code and the Twig Template Engine
Typography.js3,7572,2061864 months ago79May 10, 202195mitJavaScript
A powerful toolkit for building websites with beautiful design
Argon Theme3,160
2 months ago120gpl-3.0PHP
📖 Argon - 一个轻盈、简洁的 WordPress 主题
Understrap2,9578112 days ago37November 08, 202175gpl-3.0CSS
Underscores + Bootstrap = Understrap, the renowned open-source WordPress starter theme.
Sakura2,947
2 months ago20gpl-2.0PHP
A Wonderful WordPress Theme: 樱花庄的白猫博客主题
Frontity2,8236672 months ago60July 19, 202266apache-2.0TypeScript
» Frontity - The React Framework for WordPress
Foundationpress2,780
4 years ago35April 12, 201955mitPHP
FoundationPress is a WordPress starter theme based on Foundation 6 by Zurb
Kratos2,708
a day ago7gpl-3.0PHP
📖 WordPress theme that focus on reading experience
Plugin Update Checker1,927633021 days ago31July 24, 202279mitPHP
A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
Alternatives To Genesis Theme Toolkit
Select To Compare


Alternative Project Comparisons
Readme

Genesis Theme Toolkit

Building blocks to develop a config-based Genesis Framework child theme for WordPress.

When building a theme, wouldn't it be nice to separate out the implementation-specific config, from the reusable logic? This is the premise upon which the Using a Config to Write Reusable Code series articles are written, and which this package enables.

Specifically, this packages builds upon the Theme Toolkit package, and adds bricks that are specific to Genesis child theme development. It provides an easy way to:

  • Filtering the default Genesis breadcrumb arguments.
  • Registering and unregistering Genesis layouts.
  • Unregistering templates inherited from Genesis (extends Theme Toolkit functionality)
  • Filters Genesis theme settings defaults, or forces them to specific values.
  • Register and unregister widget areas, added by Genesis (extends Theme Toolkit functionality)
  • Customise the footer credits string.
  • Implement a custom inline logo using WordPress add_theme_support( 'custom-logo' ) functionality.

Why?

The ThemeToolkit and GenesisThemeToolkit packages are for theme customisations - what theme support to add, what CSS/JS dependencies to add in, how many footer widgets to allow, what layouts to add/remove, what image sizes there should be - all stuff that would historically gone into functions.php or some other include file.

When that is all set in functions.php though, the important values are often lost in a mixture of logic (what to do with those values), and boilerplate (opening and closing functions, hooking in to filters etc.), and that can make it harder for end theme authors to seek out and configure those important values to their liking.

By following a sort of separation of concerns principle, we use a config file to keep the important values all in one place (easy to tell people where and how to edit), and then keep the rest of the logic and boilerplate away from those who are less confident with PHP. They get a single place to make amendments, and you don't have to maintain the default logic.

Any theme can use the ThemeToolkit, and Genesis child theme can use this GenesisThemeToolkit.

For premium themes, you would set the toolkit(s) as a composer dependency, to pull it in locally for development, and then just be sure to include vendor/gamajo/... within your distributable theme zip.

Installation

Requires PHP 7.1.

In a terminal, browse to the directory with your theme in and then:

composer require gamajo/genesis-theme-toolkit

You can then autoload (PSR-4) or require the files as needed.

Usage

See the example-config.php. This would typically live in your theme, at config/defaults.php.

Your theme would then contain a function, in the functions.php, to pull in this config, and load up the individual components, which are referred to as bricks:

// functions.php

namespace Gamajo\ExampleTheme;

use BrightNucleus\Config\ConfigFactory;
use Gamajo\GenesisThemeToolkit\BreadcrumbArgs;
use Gamajo\GenesisThemeToolkit\CustomLogo;
use Gamajo\GenesisThemeToolkit\FooterCreds;
use Gamajo\GenesisThemeToolkit\Layouts;
use Gamajo\GenesisThemeToolkit\Templates;
use Gamajo\GenesisThemeToolkit\ThemeSettings;
use Gamajo\GenesisThemeToolkit\WidgetAreas;
use Gamajo\ThemeToolkit\GoogleFonts;
use Gamajo\ThemeToolkit\ImageSizes;
use Gamajo\ThemeToolkit\ThemeSupport;
use Gamajo\ThemeToolkit\ThemeToolkit;
use Gamajo\ThemeToolkit\Widgets;

add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' );
/**
 * Theme setup.
 *
 * Compose the theme toolkit bricks.
 */
function setup() {
	$config_file = __DIR__ . '/config/defaults.php';
	$config = ConfigFactory::createSubConfig( $config_file, 'Gamajo\ExampleTheme' );

	// These bricks are run in admin and front-end.
	$bricks = [
		ImageSizes::class,
		Templates::class,
		ThemeSupport::class,
		Widgets::class,
		Layouts::class,
		ThemeSettings::class,
		WidgetAreas::class,
		CustomLogo::class,
	];

	// Apply logic in bricks, with configuration defined in config/defaults.php.
	ThemeToolkit::applyBricks($config, ...$bricks);


	if ( ! is_admin() ) {
		// Only front-end bricks.
		$bricks = [
			FooterCreds::class,
			BreadcrumbArgs::class,
			GoogleFonts::class,
		];

		ThemeToolkit::applyBricks($config, ...$bricks);

	}
}

The 'Gamajo\ExampleTheme' string matches the two keys in the return at the bottom of the config file. Change this in the config and the function to be your company name and theme name.

You don't have to use all of the bricks in this package; pick and choose.

You can add your own bricks to your theme (in your src/ or similar directory), and then make use of them in the function above.

If you're not using the Genesis Framework, see the Theme Toolkit which has just the bricks applicable for building themes in general.

Change Log

Please see CHANGELOG.md.

Credits

Built by Gary Jones
Copyright 2017 Gamajo

Popular Wordpress Projects
Popular Theme Projects
Popular Content Management Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Theme
Wordpress