Archived topic
Child-Theme not working
4 replies · Started by Julia on October 10, 2018
Hi
I wanted to create my own template in child-theme. But when I add a page-custom.php at my generatepress-child folder, it doesn't work. Only when I add the file to the generatepress folder.
The same problem I have with custom post types. When I add them to functions.php in generatepress folder, it works. In child not.
As I don't see the printscreen either, I think there is a linking problem somewhere. Surprisingly the CSS works.
Can you help me please?
Thanks in advance
Julia
Hi there,
That's strange - if the CSS in your child theme is working, the functions should be as well.
Does your functions.php file have anything else in it?
What about page-custom.php? Does it have the necessary template name at the top?: https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use
The content of functions.php is:
<?php
function child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/css/style.css' , array('parent-style'));
}
add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
The template name is referenced as follows:
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* Template name: Kooperationen
*
* @package GeneratePress
*/
solved, don't ask me, what the problem was ;) I replaced my child theme with your empty child theme and now it works...
thanks
Awesome :)