0

I want to override a parent theme. I tried the codes below (and many others from parent-style till panoramic-style in functions.php but no luck). After all the modifications I refresh the admin page and can't see the child theme. What do I do wrong?

Folder hierarchy:

Parent:

E:\xampp\htdocs\wordpress\wp-content\themes\panoramic

Child:

E:\xampp\htdocs\wordpress\wp-content\themes\panoramic\panoramic-child

In the child folder I created a style.css and a functions.php So let's see some codes:

panoramic-child/functions.php

<?php

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
  wp_enqueue_style( 'panoramic', get_template_directory_uri() . '/style.css' );
  wp_enqueue_style( 'panoramic-child', get_stylesheet_uri());
}

?>

panoramic-child/styles.css

/*
 * Theme Name: Panoramic child
 * Theme URI: http://www.outtheboxthemes.com/themes/panoramic/
 * Author: Out the Box
 * Author URI: http://www.outtheboxthemes.com/
 * Description: Panoramic is a well designed, fully responsive theme
 * Version: 1.0.18
 * License: GNU General Public License v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: panoramic-child
 * Template: panoramic
 */

.page-id-2 #secondary{
  display:none;
}

styles.css (the parent one's header comment section)

/*
 * Theme Name: Panoramic
 * Theme URI: http://www.outtheboxthemes.com/themes/panoramic/
 * Author: Out the Box
 * Author URI: http://www.outtheboxthemes.com/
 * Description: Panoramic is a well designed, fully responsive theme with a homepage slider that's easy to customize and offers 5 star support. The subtle design features give it a premium feel and the wide range of flexible theme options help you create a variety of sites from a simple blog to a fully functional online eCommerce store. Used in conjunction with SiteOrigin's drag and drop Page Builder plugin, you can easily build beautiful page layouts with no coding knowledge to create any website from travel to business to food, decor, lifestyle, sport and more. Panoramic integrates seamlessly with the following popular free plugins: SiteOrigin's Page Builder, Contact Form 7 and WooCommerce.
 * Version: 1.0.18
 * License: GNU General Public License v2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: panoramic
 * Template: panoramic
 */
2

The problem is in the folder structure. The child theme should be in the same directory as the parent theme. That is:

E:\xampp\htdocs\wordpress\wp-content\themes\panoramic-child

Not:

E:\xampp\htdocs\wordpress\wp-content\themes\panoramic\panoramic-child

Also you don't need this line in the header comment of a parent theme's style.css:

Template: panoramic

It is used only in a child theme.

  • Thanks! Now it has affect on the page and I can see in the administrator pane : ) But I have another question: is it normal that all the changes I made in the parent (like header color, header image, footer color etc..) has lost? Or am I still missing something? – Slenkra Nov 13 '16 at 7:47
  • It depends on where you made those changes. If you are talking about the changes in Customizer, then yes. Child and parent are still technically different themes and store theme mods in different rows in the database. – Dmitry Mayorov Nov 13 '16 at 8:45
  • Yes I used that left pane WYSIWYG tool. I thought about to copy the database but I'm afraid to do it : ) – Slenkra Nov 13 '16 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.