• Created child theme with function.php and style.css.

    Do I have to create a page.php, if yes, what code should a add it?

    Tried duplcating the page.php from parent theme, but it couldn’t work. I must have missed out some detail.

    Need help and advice.
    Thank you.

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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the goal you’re trying to achieve?

    Thread Starter Edwin

    (@rollerband)

    I activated the child theme, however, page was not shown just like the parent theme.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you link to a page with the issue?

    Thread Starter Edwin

    (@rollerband)

    I’ve switched back to parent’s theme.
    Everything is the same, except for the missing menu of pages on the left panel.

    Here’s the link

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the name of your child theme folder?

    You need to activate the child theme if you want help with getting it to work.

    You also need to set up the menu again in the child theme – sounds like that may be the problem.

    EDIT – and also reselect the widgets in the child theme, if that’s what’s missing in the sidebar

    Thread Starter Edwin

    (@rollerband)

    I have activated the child theme. Folder name: twentyfifteen-child

    Pls visit,

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Okay so your Child Theme style.css file doesnt have an “@import” line, this means that you have to be enqueing the parent theme’s styles through your Child Theme functions.php file: https://codex.www.ads-software.com/Child_Themes#How_to_Create_a_Child_Theme

    Thread Starter Edwin

    (@rollerband)

    No, it doesn’t have @import. Read somewhere this is not a recommended way of doing.
    So, the latter link you provided is exactly what I have followed, i.e enqueing the parent theme’s styles.

    Anything missing to prevent the page menu from appearing in Child theme?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are you absolutely sure your file name is “function.php”? It should be “functions.php”.

    Thread Starter Edwin

    (@rollerband)

    I have checked, its “functions.php”.
    Thread above is a typo, sorry.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Could you post here the contents of your functions.php file?

    Thread Starter Edwin

    (@rollerband)

    Here’s the code.

    <?php // Opening PHP tag - nothing should be before this, not even whitespace
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
     }
    
    ?>
    
    <?php
    
    // Adding Child theme
    
    	wp_dequeue_style('twentyfifteen_fonts_url');
    function child_dequeue_fonts() {
    }
    add_action('wp_enqueue_scripts', 'child_dequeue_fonts' );
    
    function load_child_fonts() {
    	wp_register_style(
    		'child-2015googleFonts',
    		'https://fonts.googleapis.com/css?family=Open-Sans'
    	);
    	wp_enqueue_style('child-2015googleFonts');
    }
    add_action('wp_print_styles', 'load_child_fonts');
    
    ?>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Looks normal; I can’t suggest anything else until you switch back to your Child Theme sorry.

    Thread Starter Edwin

    (@rollerband)

    Already switched.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Page for Child Theme’ is closed to new replies.