Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using Genesis as my theme framework, and while Genesis is at version 2.0.1, my theme is a different version (1.0). When it adds the style.css line in the header call it is appending the wrong version... the one from the parent theme (2.0.1) instead of my theme version.

<link rel='stylesheet' id='child-theme-css'  href='http://localsite.dev/wp-content/themes/mytheme/style.css?ver=2.0.1' type='text/css' media='all' />

I've tried dequeuing the style via wp_dequeue_style and wp_register_style but nothing really seems to make the change.

Any suggestions?

Some clarification, in header.php there's the standard genesis call to do_action( 'genesis_meta' );

In my functions.php I have attempted to override that with:

remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
add_action( 'genesis_meta', 'my_stylesheet' );
function my_stylesheet() {
    $themeDir = trailingslashit( get_stylesheet_directory_uri() );
    $cachebuster = time();

    // my attempt to remove genesis' child-theme call with the incorrect version
    wp_dequeue_style( 'child-theme' );
    wp_deregister_style( 'child-theme' );

    wp_enqueue_style( 'stylesheet', $themeDir . 'style.css', false, '1.0-' . $cachebuster);
}

EDIT:

Genesis style sheet code:

/**
 * Enqueue main style sheet.
 *
 * Properly enqueue the main style sheet.
 *
 * @since 1.9.0
 *
 * @uses CHILD_THEME_NAME
 * @uses CHILD_THEME_VERSION
 * @uses PARENT_THEME_VERSION
 */
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 );

}
share|improve this question
    
Post the code that registers and enqueues the stylesheet please. –  s_ha_dum Sep 2 '13 at 15:43
    
That's the thing. I'm not sure where it's getting enqueued. I've figured that it's being called via the genesis framework, and during the do_action( 'genesis_meta' ); call. But I'm not sure how to override it. I've updated the question with some explanation and code of what I'm doing. –  Jason Sep 2 '13 at 15:51
    
Search the Genesis theme code for child-theme and find where it is registered. That should help sort out a solution. –  s_ha_dum Sep 2 '13 at 15:56
    
I have added the Genesis Framework code. Did you set the CHILD_THEME_VERSION constant to '1.0' in the function.php child theme file? –  Charles Clarkson Sep 2 '13 at 18:07

1 Answer 1

If you add this code to your child theme's functions.php file it will append the style sheet link in your site's head with the child theme version instead of the Genesis version:

define( 'CHILD_THEME_VERSION', wp_get_theme()->get( 'Version' ) );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.