WordPress child theme is not shown as the parent theme

2

I have made a child theme, creating the stlye.css and functions.php files. My theme has multiple * .css and * .php files. The issue is that I can not get the web to show up as the parent theme. Missing elements (mainly in the Homepage). I would like to know the reason for this. I describe below the steps taken so far:

  • I have created the file style.css with the necessary requirements (field "Template" = name of the parent theme and others).

  • In the functions.php file I have included the following code: (see code at the end of this writing).

  • I have tried to locate from which files come some elements of the web that do not appear in the child theme (on the homepage of the web). I indicate some examples below:

    • For example, the="widget-wrap" found in the following file located in the following parent theme path: MusicTheme \ widgets \ class-tmpl-image-gallery.php, not found in the child-theme.

    • Another example: a text that heads a section within the homepage of the web: "New Release Album" and is within the previous one. This text is located in the following file: MusicTheme \ functions \ auto_install \ import-widgets.wie

    • The following text: "This is an example of an event.You could add your" located in the path: MusicTheme \ functions \ auto_install \ music-dummy-data.xml

  • By doing tests, I chose to copy all the files (php and css) of the parent theme to the child-theme and some of the information that was not shown, already appears in the child theme. However, despite this, some information is still not shown, such as the first section above.

  • For information purposes, in the "Settings> Reading" section (from the Wordpress desktop) the homepage is defined as: "A static page", with the options: "Homepage: Home" and "Post page" : Blog ".

  • Issues:

  • What is the correct way to proceed so that the same web appears to me if the parent theme is activated?

  • Is it good practice to copy all the php / css files from the parent theme and include them in the child-theme?

  • Code included in the functions.php (child theme) file:

    <?php
    function wpshout_enqueue_MusicTheme_stylesheet () {
    
    $parent_style = 'main-music-style';
    $bs_style = 'bootstrap-min-style';
    $font_style = 'fontawesomecss';
    $tmpl_style = 'tmpl-music-style';
    $comp_style = 'component-style';
    $rtlbs_style = 'tmpl-rtl-bootstrap-style';
    $rtlst_style = 'tmpl-rtl-style';
    $cust_style = 'tmpl-customizer-css';    
    $colors_style = 'colors';
    $ie_sytle = 'ie';
    
    $child_style  = 'main-music-style-child-style';
    $child_bs_style = 'bootstrap-min-child-style';
    $child_font_style = 'fontawesomecss-child';
    $child_tmpl_style = 'tmpl-music-child-style';
    $child_comp_style = 'component-child-style';
    $child_rtlbs_style = 'tmpl-rtl-bootstrap-child-style';
    $child_rtlst_style = 'tmpl-rtl-child-style';
    $child_cust_style = 'tmpl-customizer-child-css';
    $child_colors_style = 'colors-child';
    $child_ie_style = 'ie-child';
    
    
    wp_enqueue_style( $parent_style,
                get_template_directory_uri() . '/style.css' );
    
    wp_enqueue_style( $bs_style,
                get_template_directory_uri() . '/css/bootstrap.min.css' );
    
    wp_enqueue_style( $font_style,
                get_template_directory_uri() . 
    'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-
    awesome.min.css' );
    
    wp_enqueue_style( $tmpl_style,
                get_template_directory_uri() . '/theme-style.css' );
    
    wp_enqueue_style( $comp_style,
                get_template_directory_uri() . '/css/component.css' );
    
    wp_enqueue_style( $rtlbs_style,
                get_template_directory_uri() . '/css/rtl-bootstrap.css' );
    
    wp_enqueue_style( $rtlst_style,
                get_template_directory_uri() . '/css/rtl.css' );
    
    wp_enqueue_style( $cust_style,
                get_template_directory_uri() . '/css/admin_style.css' );
    
    wp_enqueue_style( $colors_style,
                get_template_directory_uri() . '/css/colors.css' );
    
    wp_enqueue_style( $ie_style,
                get_template_directory_uri() . '/css/ie.css' );         
    
    
    wp_enqueue_style( $child_style,
                get_stylesheet_directory_uri() . '/style.css',
                array( $parent_style ),
                wp_get_theme()->get('1.1.2')
                );
    
    wp_enqueue_style( $child_bs_style,
                get_stylesheet_directory() . '/css/bootstrap.min.css',
                array( $bs_style ),
                wp_get_theme()->get('1.1.2')
                ); 
    
    wp_enqueue_style( $child_font_style,
                get_stylesheet_directory() . 
    'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-
    awesome.min.css',
    array( $font_style ),
    wp_get_theme()->get('1.1.2')
    ); 
    
    wp_enqueue_style( $child_tmpl_style,
    get_stylesheet_directory() . '/theme-style.css',
    array( $tmpl_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    
    wp_enqueue_style( $child_comp_style,
    get_stylesheet_directory() . '/css/component.css',
    array( $comp_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    wp_enqueue_style( $child_rtlbs_style,
    get_stylesheet_directory() . '/css/rtl-bootstrap.css',
    array( $rtlbs_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    wp_enqueue_style( $child_rtlst_style,
    get_stylesheet_directory() . '/css/rtl.css',
    array( $rtlst_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    wp_enqueue_style( $child_cust_style,
    get_stylesheet_directory() . '/css/admin_style.css',
    array( $cust_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    wp_enqueue_style( $child_colors_style,
    get_stylesheet_directory() . '/css/colors.css',
    array( $colors_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    wp_enqueue_style( $child_ie_style,
    get_stylesheet_directory() . '/css/ie.css',
    array( $ie_style ),
    wp_get_theme()->get('1.1.2')
    );
    
    }
    add_action( 'wp_enqueue_style', 'wpshout_enqueue_MusicTheme_stylesheet' );
    
        
    asked by fernanf 08.03.2018 в 01:12
    source

    2 answers

    1

    There is no need to copy the parent theme files to the child theme. Wordpress automatically takes what you need from the parent theme.

    As a consequence of the above, what you do need is that the two themes are installed, the child and the parent.

    When the theme you use as a parent has custom configurations and active the child theme, as in practice you are changing the theme, these customizations are lost (widget, colors, home page) and you need to upload them again.

    The function that you put looks correct, so I suppose that your problem must come by this last one.

    If you are not sure where the problem lies, I would recommend you first create a clean child theme with the Child Theme Configurator and from this customize. For more data I recommend the second part of this article (Create a child theme automatically): link

        
    answered by 09.03.2018 / 01:55
    source
    0

    Do not forget to copy the file index.php in the folder of the child theme (in all the tutorials that I saw, they ignore it). The subject twentyseventeen appeared to me despite the fact that the father theme was shapely?, Which implied that no change in the css was going to be seen. I hope it serves you.

        
    answered by 13.07.2018 в 16:27