Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Last active December 10, 2015 20:18
Show Gist options
  • Select an option

  • Save GaryJones/4486789 to your computer and use it in GitHub Desktop.

Select an option

Save GaryJones/4486789 to your computer and use it in GitHub Desktop.
Genesis 1.9.0 change for referencing the child theme style sheet.
<?php
// lib/structure/layout.php in Genesis 1.8.2
add_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Echo reference to the style sheet.
*
* If a child theme is active, it loads the child theme's stylesheet,
* otherwise, it loads the Genesis stylesheet.
*
* @since 0.2.2
*/
function genesis_load_stylesheet() {
echo '<link rel="stylesheet" href="'.get_bloginfo( 'stylesheet_url' ).'" type="text/css" media="screen" />'."\n";
}
<?php
// lib/css/load-styles.php in Genesis 1.9.0
add_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Echo reference to the style sheet.
*
* If a child theme is active, it loads the child theme's stylesheet,
* otherwise, it loads the Genesis stylesheet.
*
* @since 0.2.2
*/
function genesis_load_stylesheet() {
add_action( 'wp_enqueue_scripts', 'genesis_enqueue_main_stylesheet' );
}
/**
* Enqueue main stylesheet.
*
* Properly enqueue the main stylesheet.
*
* @since 1.9.0
*/
function genesis_enqueue_main_stylesheet() {
$version = defined( 'CHILD_THEME_VERSION' ) && CHILD_THEME_VERSION ? CHILD_THEME_VERSION : PARENT_THEME_VERSION;
$handle = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'child-theme';
wp_enqueue_style( $handle, get_stylesheet_uri(), false, $version );
}
<?php
// lib/css/load-styles.php in Genesis 1.9.0
add_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Echo reference to the style sheet.
*
* If a child theme is active, it loads the child theme's stylesheet,
* otherwise, it loads the Genesis stylesheet.
*
* @since 0.2.2
*/
function genesis_load_stylesheet() {
add_action( 'wp_enqueue_scripts', 'genesis_enqueue_main_stylesheet', 5 );
}
/**
* Enqueue main stylesheet.
*
* Properly enqueue the main stylesheet.
*
* @since 1.9.0
*/
function genesis_enqueue_main_stylesheet() {
$version = defined( 'CHILD_THEME_VERSION' ) && CHILD_THEME_VERSION ? CHILD_THEME_VERSION : PARENT_THEME_VERSION;
$handle = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'child-theme';
wp_enqueue_style( $handle, get_stylesheet_uri(), false, $version );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment