Same custom header in parent and child

I have made a child theme from the Sydney theme, but I had already made customisations through the Appearance>Customize tab. However, none of these changes (color, header, blog option) is transfered to the child.

I found out that those changes are somewhere stored in an SQL database. Is it possible to link the child to those customized values? I think it might be possible to solve with the ‘enqueue’ statement in functions.php, but I can’t find which code to insert.

At this moment, I have:
<?php

add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_styles’ );

function enqueue_parent_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
}

Hello there,

The inline style associated with the customizer is called from the main theme – it’s stored in the inc/styles.php file. You can override it from your child theme’s functions.php file. The below is an example of modifying the menu items font size.


function sydney_child_custom_styles($custom){

  $custom .= '';

  //Menu
  $menu_size = 20;
  if ($menu_size) {
      $custom .= "#mainnav ul li a { font-size:" . intval($menu_size) . "px; }"."\n";
  }

  //Output all the styles
  wp_add_inline_style( 'sydney-style', $custom );

}
add_action( 'wp_enqueue_scripts', 'sydney_child_custom_styles', 999 );

Regards,
Kharis

Thank you for your reply Kharis.
I don’t want to make the child and parent different in the header, I want to have them the same. However this was not the case for many of the modifications done through the customizer.

Difference between parent and child

In this image, I have put the same website, on the left in parent theme, on the right in child theme. In the parent, there is a logo in the header, while in the child, it is the site title and tag line. The content of the slider headings (text and image) are completely different. The action button is still in the child theme and the primary color is different too.

I couldn’t see the image, so maybe this link will work.

Another addition: I even copied all the files from the parent to the child folder, except for style.css and functions.php, but it still gave the lay-out and header content of the demo.

Hello there,

Thank you for the screenshot.

The settings you’ve done with the main theme seems can’t be instantly synced when the child theme activated. To sync it, try to do the below steps:

  1. Install and activate this plugin (while having the main theme active).
  2. Go to Appearance > Customize > Export/Import and click on Export. You will automatically download a file.
  3. Open that file in any text editor (like Notepad on Windows, TextWrangler on Mac) and do a Find & Replace (Ctrl+H in Notepad, ⌘F in TextWrangler) for s:6:“sydney” and replace with s:13:“your-child-theme-folder-name”. Save the file.
  4. Switch to Sydney Pro and visit again Customize > Export/Import. This time you will upload the file you’ve just edited. That’s it, you’re free to deactivate and remove the plugin now.

Let me know how it goes.

Regards,
Kharis

I found the same problem on this forum post. Despite it being opened 3 years ago and last edited 4 months ago, I don’t understand yet enough to know if there is already a solution and if it would also work on Sydney. Can somebody advice me please?

Hi @NaomiG,

Please follow my last reply above for the solution. Let me know how it helps.

Regards,
Kharis

The above solution was indeed what I needed. Thank you very much.

One more question. Is there a way to revert the changes from the first script for changing the front size? Those changes are still there.

There is no way to reset particular options at specific state in the past. However, you can manually adjust the font size values with the default ones as seen on the below screenshot.

Cloudup

Regards,
Kharis

The lay-out changed when I was using enqueue parent style, but when I used the import in the style sheet, it was like my parent theme. I know it’s not the best solution, but it will work for now.

Thank you very much for your help.