Support » Themes and Templates » Versioning TwentyTwelve's CSS

  • Resolved coopersita

    (@coopersita)


    Hi,

    I’m making a child theme for TwentyTwelve, but my host is caching my files, so I’m not seeing the changes I do to my style.css file.

    Is there a way to version the stylesheet for my child theme?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ok, so what I did to fix it, is add a functions.php to my child-theme, and added the following:

    <?php
    function my_theme_styles() {
        wp_enqueue_style('my-theme-style', get_bloginfo('template_directory') . '/style.css', false, date('h:i:s'));
    }
    add_action('wp_head', 'my_theme_styles');

    So it loads the stylesheet twice, which is not ideal, but while the site is being developed, it helps keep the stylesheet fresh.

    Actually, this code will work. I had the wrong path to the theme’s folder:

    <?php
    function my_theme_styles() {
        wp_enqueue_style('my-theme-style', get_stylesheet_directory_uri(). '/style.css', false, date('h:i:s'));
    }
    add_action('wp_print_styles', 'my_theme_styles');
    Moderator Andrew Nevins

    (@anevins)

    Thanks for sharing 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Versioning TwentyTwelve's CSS’ is closed to new replies.