This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Adding new CSS stylesheet between bootstrap.css and themeblvd.css

  • Creator
  • #3076

    Hi Jason,
    I am doing some more complex CSS tweaks and need to insert additional CSS file between bootstrap.css and themeblvd.css, which all have the same priority. Is it possible to do this using functions in child theme?
    Thanks a lot

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #3101
    Jason Bobich

    Hello Martin,

    The only way this would be possible I think would be ditch the framework function that enqueues those CSS files.

    remove_action( 'wp_enqueue_scripts', themeblvd_include_styles' );

    And then, you’d just include the framework’s four CSS files from your own function that’s hooked to “wp_enqueue_scripts” in your Child theme.

    my_styles() {
    	wp_enqueue_style( 'bootstrap', TB_FRAMEWORK_URI . '/frontend/assets/plugins/bootstrap/css/bootstrap.min.css', array(), '2.2.1' );
    	wp_enqueue_style( 'fontawesome', TB_FRAMEWORK_URI . '/frontend/assets/plugins/fontawesome/css/font-awesomeness.min.css', array(), '2.0' );
    	wp_enqueue_style( 'prettyphoto', TB_FRAMEWORK_URI . '/frontend/assets/plugins/prettyphoto/css/prettyPhoto.css', array(), '3.1.3' );
    	// your stylesheet between bootstrap and framework...
    	wp_enqueue_style( 'themeblvd', TB_FRAMEWORK_URI . '/frontend/assets/css/themeblvd.min.css', array(), TB_FRAMEWORK_VERSION );
    	//  your other stylesheets
    add_action( 'wp_enqueue_scripts', 'my_styles' );

    In this case, you can also ditch the use of $themeblvd_framework_stylesheets in the stylesheets that follow, as you’re doing everything here in your own function.


    Butting in but very related.

    Now you remove action, add a new modified one, but is there any technical reasons to not just declare

    function themeblvd_include_styles() { blah blah

    as the one in parent theme is wrapped in “if not function exist already” logic?

    I put money on “what ever” or “yes there are technical differences, look at core source code” answer but only one way to be sure so I ask.

    • This reply was modified 9 years, 4 months ago by karlo.
    • This reply was modified 9 years, 4 months ago by Jason Bobich.

    Hello Jason,
    thanks for clarification! I have one additional question. How can I add new CSS stylesheet just before child-theme`s style.css?

    Yes, I can add new CSS between framework styles and style.css (as described in Developer doc), but in that case the stylesheet is not just before style.css so i can`t override CSS from your gmap plugin or news scroller.

    Thanks a lot!

    Jason Bobich

    @karlo You could definitely do it that way, as well. Personally I think this method of “editing” a theme function should be a last resort only. I think any time that you could modify the hooks and hook in your own function, this is a more organized way of tackling these issues, moving forward with updates.

    @Martin Similar to the last example, you could do the exact same thing with the jumpstart_css function found in /includes/theme-functions.php. — This is where style.css is currently enqueued.


    Yeah it can get confusing. add/remove actions, replace functions based on “!” character, overriding JS/CSS by registrering with same handle. Or with regards to JS/CSS use that global filter you talked about in other thread. Unless some fun is had using different methods it is probably best to settle for one or have it as first choice. Add/remove actions score highest on readability chart.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.