• Vasily
    September 2, 2013 at 12:34 pm #3393

    Hi there!
    I created child theme with custom style.css and made some changes with search button colors and image. So my custom styles works great but the problem is – when I resize the window the search button takes styles from my_media.css. For sure I can make changes in parent theme but I would like to use different css files in case of future updates of parent theme. Can you please advice me how to connect my custom my_media.css too?
    Thank you for help!

    September 2, 2013 at 7:14 pm #3395

    Hi Vasily,

    In child theme – style.css – re-write the queries your want to modify from my_media.css We separated them to be easy to modify. But they can be in the same style.css file.

    Or – go to functions.php child theme deregister my_media.css and register a new my_media.css files.

    If you need help, please let me know.

    Thank you!

    September 3, 2013 at 11:25 am #3398

    Hi Anna,
    The first way you are suggested doesn’t work for me =(
    I just put next code in my style.css in the child theme:

    @media only screen and (max-width: 959px){
    .search_map:hover {
    background: url('css/css-images/searchbutton.png');
    background-color: #13b0cb;

    But it’s ignored by theme and continue apply from parent my_media.css
    What I did wrong? Help me please.. )

    The second way looks too difficult for me coz I not really understand how to deregister old one and register another..

    Many thanks in advance!

    September 3, 2013 at 12:00 pm #3399

    At the moment I solved my problem with inserting all styles for search button into custom CSS area in the admin panel of the theme like this:

    @media only screen and (max-width: 959px){
    .search_map, .search_map:hover {

    If I put only some custom parameters then others just doesn’t want to apply from the native my_media.css. Thats why I need to put all of it…

    But I would be greatly appreciate it if you kindly help me with function.php (now this is just empty file in my child theme)
    Thanks a lot!

    September 5, 2013 at 9:05 am #3402


    OK let’s do like this.

    1. In child theme functions.php deregister the my_media.css – use this function: http://codex.wordpress.org/Function_Reference/wp_deregister_style

    2. create a new style for media in your child theme (if you need it) and use wp_enqueue_style to load it.

    3. move the code from custom css to new style and test.

    Let me know how it works.

    January 22, 2015 at 5:54 am #102109

    I would like to receive an update on this. According to WordPress dequeuing doesn’t work if @import is also used. @import is even not considered best practice anymore. Yet both WPEstate and WPresidence still use @import. So how to properly use child versions of style.css and others under the css directory? What should be in the child.css and functions.php file and what .css files can then be placed under child? Thank you.

    Following WordPress I created a functions.php as below, but it breaks my site, only blank pages show up:

    <link rel=”stylesheet” id=”wpresidence-style-css” href=”/wpresidence/style.css” type=”text/css” media=”all”>

    <link rel=”stylesheet” id=”custom-style” href=”/wpresidence/my_media.css” type=”text/css” media=”all”>

    • This reply was modified 1 year, 9 months ago by  mitchoo. Reason: added content
    January 22, 2015 at 8:19 am #102117

    The approach below works for style.css. Still need advice how to enqueue my_media.css and the other .css files which are under /wpresidence/css/

    1. create functions.php under child themes with this content


    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );


    2. remove the @import part under style.css

    @import url(“../wpresidence/style.css”);

    January 22, 2015 at 10:01 am #102140

    Hi Mitchoo

    Thank you for the email. I did not see the comments until you sent the 2nd one. The BB PRESS forum plugin does that sometimes. In case of emergencies – you can also use our private ticket system – support.wpestate.org Those emails we get all the time.

    As to best practices – we will review this as well. Thank you very much for pointing this to us.

    Thank you

    January 22, 2015 at 3:12 pm #102149

    Look into css_js_include.php and see how other css files are included

    For example at line 94 there is
    wp_enqueue_style(‘wpestate_style’,get_stylesheet_uri(), array(), ‘1.0’, ‘all’);
    wp_enqueue_style(‘wpestate_media’,get_template_directory_uri().’/css/my_media.css’, array(), ‘1.0’, ‘all’);
    wp_enqueue_style(‘prettyphoto’,get_template_directory_uri().’/css/prettyphoto.css’, array(), ‘1.0’, ‘all’);

    January 23, 2015 at 2:20 am #102159

    Tried several combinations, they either don’t work or result in site going blank. Probably the .css files can’t be enqueued that easily because you have hardcoded something somewhere. For example, I found that your bootstrap.css prioritises itself in different ways. Being the site developer, could you provide a working functions.php that enqueues all the css files under css directory? That way everyone can safely apply all the optional changes under the child-theme, as you advise.

    January 23, 2015 at 10:07 am #102167

    I don’t what you are doing but things are very very easy.

    When you create a child theme you need to make a style.css in child theme folder
    in the header of style.css you need to have

    Theme Name: Wp Estate Child
    Theme URI: http://wpestatetheme.org/
    Template: wpestate
    Description:WP Estate Child theme
    Author: Ana Maria – annapx0909@gmail.com
    Author URI:
    Text Domain: wpestate
    Tags: white, one-column, two-columns,left-sidebar, right-sidebar, flexible-width, custom-menu, theme-options, translation-ready
    License URI:
    @import url(“../wpestate/style.css”);

    the example is made for wpestate. Replace wpestate with wpresidence and it will work for wpresidence theme also.

    this is how child themes are made – the style.css from child is appended to the original theme style.css

    Second – if for some reason you want to include another css file then in child theme you need to create a functions.php that will also be appended to the original functions.php

    in the functions.php you can use instructions like
    wp_enqueue_style(‘wpestate_media’,get_template_directory_uri().’/css/my_media.css’, array(), ‘1.0’, ‘all’);

    but with a small difference :
    instead of get_template_directory_uri() use get_stylesheet_directory_uri() – see here why : http://codex.wordpress.org/Function_Reference/get_template_directory_uri

    All the info i just posted here are available free on wordpress.com . Also i don;t want to be rude but i think you may need to study a little about how the child theme are working.

    In the end – there is nothing hard coded or something similar- themeforest will not allow for such things. You just need to read the documentation and apply what is says in there.

    Good Luck

    January 23, 2015 at 11:31 am #102170

    If it’s so easy why not just give the correct enqueue for my_media.css?
    @import url is not the same as enqueeing, and doesn’t work for my_media.css, correct.
    I studied long and hard and shared a working fuctions.php in this thread to enqueue style.css.
    Both the template and stylesheet directory referrals lead to php errors and a blank site.
    I wish I had the answer, I bet am far from being the only one fighting this. Thanks anyway.

    January 23, 2015 at 12:14 pm #102171

    Hi mitchoo

    We are trying to help and that is what we have been trying to do so far :). We would need to do the code to be able to send it.

    Right now we’re working on 1.09 and we have all focus there.

    After we launch 1.09 we will put in practice what we read on wordpress as well. And I will keep you posted on our results.


    January 26, 2015 at 5:26 pm #102222


    Send me an email at annapx0909@gmail.com and I will send you a child theme with functions.php enqueue code that works without any issues. The theme was not the issue for sure 🙂

    Thank you

    March 22, 2015 at 3:06 am #104840

    Finally we found a solution provided by a WordPress plug-in:

    Child Theme Configurator (CTC) allows you to select both Theme and Plug-in CSS files from a long list created by this application. It then enqueues (and prioritizes) all automatically. You copy/paste your changes from Web developer tools in Firefox or Chrome directly into the CTC bucket that neatly shows all these changes in columns before you accept those changes. That’s basically all there is to it.

    There’s a free and premium version. We opted for the premium version. That allowed us to easily integrate Woocommerce without conflicting with the Bootstrap framework.

You must be logged in to reply to this topic.