Skip to content

Instantly share code, notes, and snippets.

@majorgreys
Last active November 23, 2017 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majorgreys/09a4c5148d9b6d59bea62f569f0f2d5b to your computer and use it in GitHub Desktop.
Save majorgreys/09a4c5148d9b6d59bea62f569f0f2d5b to your computer and use it in GitHub Desktop.
<?php
/**
* @package Make GCDI
*/
/**
* The GC Digital Initiatives Child Theme of Make
*
*
* @see MAKE_Setup_Scripts::enqueue_frontend_styles()
*/
define( 'TTFMAKE_CHILD_VERSION', '0.1' );
/**
* Turn off the parent theme styles.
*
* If you would like to use this child theme to style Make from scratch, rather
* than simply overriding specific style rules, remove the '//' from the
* 'add_filter' line below. This will tell the theme not to enqueue the parent
* stylesheet along with the child one.
*/
//add_filter( 'make_enqueue_parent_stylesheet', '__return_false' );
/**
* Define a version number for the child theme's stylesheet.
*
* In order to prevent old versions of the child theme's stylesheet from loading
* from a browser's cache, update the version number below each time changes are
* made to the stylesheet.
*
* @uses MAKE_Setup_Scripts::update_version()
*/
function childtheme_style_version() {
// Ensure the Make API is available.
if ( ! function_exists( 'Make' ) ) {
return;
}
// Version string to append to the child theme's style.css URL.
$version = '1.0.0'; // <- Update this!
Make()->scripts()->update_version( 'make-main', $version, 'style' );
}
add_action( 'wp_enqueue_scripts', 'childtheme_style_version', 20 );
function make_parent_theme_enqueue_styles() {
wp_enqueue_style( 'make-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'make-gcdi-style',
get_stylesheet_directory_uri() . '/style.css',
array( 'make-style' )
);
}
add_action( 'wp_enqueue_scripts', 'make_parent_theme_enqueue_styles' );
function gcdi_update_setting_defaults() {
$gcdi_settings = array (
'general-layout' => array( 'default' => 'boxed' ),
'background_color' => array( 'default' => 'ff0000' ),
'font-family-body' => array( 'default' => 'Roboto' ),
);
foreach ($gcdi_settings as $id => $settings) {
make_update_thememod_setting_definition( $id, $settings );
Make()->thememod()->set_value( $id, $settings["default"] );
}
}
add_action( 'make_settings_thememod_loaded', 'gcdi_update_setting_defaults' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment