Support » Fixing WordPress » Child theme does not take info from parent theme

  • Good morning everyone:

    I have developed 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 information in my child theme (mainly in the Homepage). I would like to know the reason for this one. I describe below the steps taken so far:

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

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

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

    a) For example, the <div>=”widget-wrap” found in the following path of the parent theme: MusicTheme\widgets\class-tmpl-image-gallery.php, can not be found in the child-theme

    b) Another example: a sentence that heads a section within the homepage of the web: “New Release Album” and is within the *<div>* said above. This setence is located in the following file: MusicTheme\functions\auto_install\import-widgets.wie, in parent theme but no appear in child-theme

    c) The following sentence: “This is an example of an event.You could add your” located in the path: MusicTheme\functions\auto_install\ music-dummy-data.xml.

    4. I decided 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, as for example in section a) above.

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

    Questions:

    1.If you could give me some advice on the best way to proceed so that the same web appears in the parent theme.
    2. Is it good practice to copy all the php / css files of the parent theme and include them in the child-theme?

    functions.php (child-theme):

        <?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' );
Viewing 1 replies (of 1 total)
  • Keith

    (@keithdriscoll)

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

    NO. This is not how child themes work. You only include files you want to modify but start with just the required style.css file.

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

    Template name should be the EXACT name of the FOLDER (including proper capitalization) that the parent theme resides not the name of the theme.

    Try that, and let us know how you make out 🙂

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