Header issues with child theme
-
I installed One Business Blocks and have been trying various things in it. I love how it looks and behaves. However, when I tried creating a child theme, I am always losing the header and the footer. So my site is ending up without the top navigation and the footer. At first, I tried creating the child theme manually, then also tried with Create Block Theme plugin, but with no luck. If I activate the parent theme, my header comes back, but it doesn’t work in the child theme. Any clue what I am missing here? Currently, the parent theme is active. So you should see the header and the footer.Thanks.
-
This topic was modified 1 year, 4 months ago by
abhishekc2.
The page I need help with: [log in to see the link]
-
This topic was modified 1 year, 4 months ago by
-
Hello @abhishekc2 ,
For your above query,
Header, footer, and sidebar are template parts, and to appear in your child theme, you need to override parts, patterns and the templates folder in your child theme.
Follow the below steps:
1) Copy the parts,patterns and templates folder from the parent theme “one business block” and paste it in “business child” (your child theme).
2) In your child theme’s folder, go to parts >> footer.html. replace,
<!– wp:pattern {“slug”:”one-business-blocks/footer”} /–>
with
<!– wp:pattern {“slug”:”business-child/header”} /–> (replace business-child with your child theme’s text domain)
Similarly, do it with header.html and sidebar.html.
3) In patters folder, go to footr.php and replace one-business-blocks with business-child (replace business-child with your child theme’s text-domain)
in the below lines and follow same steps for header.php and sidebar.php
<?php
/**
* Title: Footer
* Slug: one-business-blocks/footer
* Categories: one-business-blocks, footer
*/
?>
4) After the above changes, in all template files replace,
for header,
<!– wp:template-part {“slug”:”header”,”theme”:”one-business-blocks”,”tagName”:”header”} /–>
with
<!– wp:template-part {“slug”:”header”,”theme”:”business-child”,”tagName”:”header”} /–>
for footer
<!– wp:template-part {“slug”:”footer”,”theme”:”one-business-blocks”,”tagName”:”footer”,”className”:”custom-footer-class”} /–>
with
<!– wp:template-part {“slug”:”footer”,”theme”:”business-child”,”tagName”:”footer”,”className”:”custom-footer-class”} /–>
for sidebar,
<!– wp:template-part {“slug”:”sidebar”,”theme”:”one-business-blocks”,”area”:”uncategorized”} /–>
with
<!– wp:template-part {“slug”:”sidebar”,”theme”:”business-child”,”area”:”uncategorized”} /–>
Thanks.Hello Pewilliams,
I picked up the same theme “one-business-block” to test it after installing WP also configured multi sites. After doing modifications to the parent theme, I realized that I should move it to child to avoid upgrade changes. I thought this will be an easy task not another learning curve and was wrong. The child copied site showed up as if I just newly installed parent theme without menu :-(. All my optimizations and changes was gone. I tried above solution but did not work. I tried many internet suggestions and wasted time. I am here to ask what am I supposed to do to colone a modified parent site to a child theme without losing every thing.
I as unable to get the issue sorted with directions from Pewilliams. I even tried to reinstall wordpress from scratch and then follow all the instructions. But header/footer simply wouldn’t work on child theme. So I ended up switching to twenty twenty-five theme and bringing it as close to one-business-blocks as possible. I do not have the animations but those are not on top of my prio list. If I have time later, I would use custom CSS to bring back the animations.
Thanks Abhishek for your prompt response.
Actually I thought of the same solution for “twenty twenty-five”, but like to give Pewilliams another chance to respond for solution (if any) before abandoning there theme.
I also thought copying the theme to a child directory should work but NOT.
I read something in Pewilliams comments (replace business-child with your child theme’s text domain) . What dos “text domain” refer too? dos it means the child directory name or something else.
Hello,
Open your child themes syle.css and see for Text Domain.
Thanks.
The topic ‘Header issues with child theme’ is closed to new replies.
