Archived topic
Export site library to child theme
3 replies · Started by loixiyo on January 17, 2023
Hi,
I used the Site Library to create a base website. The thing is that when adding my custom contents I added new CSS, some hooks, some custom CSS etc. I would like to create a child theme and store everything together there. Is there any way to do this and do not forget anything? Or... is there any way to get a whole list of the css, settings etc that the Site Library installed automatically?
Kind regards.
Hi there,
You seem to have some misunderstanding about child theme.
If you don't create custom PHP templates, you do NOT need a child theme.
All the theme settings/elements/CSS will be stored in the parent theme, they will not get lost during theme updates.
But if you really want to use a child theme, here's the instruction: https://docs.generatepress.com/article/using-child-theme/
Hi,
Thanks for your response!
Maybe I didn't explain well:
When you import a site from the Site Library, many things are imported to your Wordpress installation: images, css, settings, pages, contents, etc... Then you can delete what you don't need or add your new stuff.
Well, after that, I created new pages, new contents, added new CSS, some PHP hooks and templates, Javascript etc that I would like to move to a unique please (theme? plugin?) so that it's all together in a GIT repo.
This is why I thought in a Child Theme. As far as I understand, a child theme allows to create a theme that reuses everything from its parent, except the things you override (post.php, for instance). I think that this is exactly my need, I can create a child theme, reuse almost everything and move my custom code there. Is this correct?
So the question is: what is the best approach to do this? How would you move the code (I can ignore posts and media, this is just contents) to a GIT repo?
I hope I explained better this time.
Regards.
I can create a child theme, reuse almost everything and move my custom code there. Is this correct?
Correct, if you want to use a custom template like single.php, a child theme is required.
Please be noted that GP has block element - content template which allows you to create templates using blocks instead of PHP templates.
How would you move the code
I attached the link to the instruction which includes how to add a child theme after importing a site library template.
So CSS goes to style.css, PHP functions go to functions.php and add templates in your child theme folder.