• Hello, I have a problem with style-mobile.css it doesnt load πŸ™
    I dont know how to make it, maybe someone will help me.
    I use plugin to create child theme and I have function.php like that:

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'tmnf-custom-style' ) );
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
    
    // END ENQUEUE PARENT ACTION
    

    I need to add style-mobile.css to that but I dont know how…

    Please help! πŸ™‚

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you just add the CSS from within style-mobile.css to your Child Theme style.css file?

    Thread Starter marcinstanczak

    (@marcinstanczak)

    I cant do that because my theme doesnt support that… When I change something in style.css what is in style-mobile.css it just doesnt work… I try :first-child and others and nothing work…
    Now I change to function.php like I found in codex

    <?php
    /**
     *Recommended way to include parent theme styles.
     *(Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
     */  
    
      add_action( 'wp_enqueue_scripts', 'child_style' );
      function child_style() {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    	wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style'));
    	wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style-mobile.css',array('parent-style'));
    }
    
    /**
     *Your code goes below
     */
    
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘function.php adding style-mobile.css child theme’ is closed to new replies.