- This topic has 13 replies, 3 voices, and was last updated 3 years, 4 months ago by ETO.
-
AuthorPosts
-
November 9, 2020 at 8:33 am #1524127ETO
Hello,
Is the child theme here compatible with latest version of Generatepress?
I had my developer make some customizations for my website and he said the child theme didn’t work properly, that was why he made the changes in parent theme.According to what I have been told, it is the same problem here: https://generatepress.com/forums/topic/including-parent-theme-file-in-child-theme/
He says he cannot include parent theme’s folders/files in child theme.
November 9, 2020 at 10:04 am #1524267LeoStaffCustomer SupportHi there,
Is the child theme here compatible with latest version of Generatepress?
Yes – that child theme simply grabs the files from the parent theme so it will be compatible with all versions of the theme.
What file is he trying to modify?
I’ve explained the issue for that post here:
https://generatepress.com/forums/topic/including-parent-theme-file-in-child-theme/#post-1508732November 9, 2020 at 2:08 pm #1524531ETOHe modified some files in “inc” and “assets” folders.
November 9, 2020 at 2:13 pm #1524538LeoStaffCustomer SupportSo as mentioned in the previous post:
By default, WordPress only allows child theme overwrites on the first level of files – so the files directly under the theme folder.
And this is not a theme thing.
What changes is he trying to make?
November 10, 2020 at 9:49 am #1525723ETOHello again, Leo!
You can find all the changes he made in the file who link I sent you as private information.I would be grateful if you can find an easy way to implement these changes so that I don’t miss the updates of the theme.
November 10, 2020 at 9:57 am #1525743LeoStaffCustomer SupportThat’s not something the theme support can help with – you will need to contact your previous developer or use a service like this:
https://generatepress.com/forums/topic/can-i-turn-my-gp-theme-into-a-child-theme/#post-592017November 10, 2020 at 10:52 am #1525791ETOYou had told me that most of the changes could be done with hooks. That is why I sent you my customization codes and ask you if these changes can be done with hooks or not.
November 10, 2020 at 10:58 am #1525798LeoStaffCustomer SupportI’m not sure what some of the code is supposed to do.
To give you a few examples:
I see a lot of CSS that should all be added using one of these methods:
Adding CSS: https://docs.generatepress.com/article/adding-css/If it says “at the bottom of
function.php
“, then it should be added using one of these methods:
Adding PHP: https://docs.generatepress.com/article/adding-php/And if it says “Before wp_head in header.php”, then that should be added using the wp_head hook:
https://docs.generatepress.com/article/wp-head/
https://docs.generatepress.com/article/hooks-element-overview/I would recommend getting in contact with your developer and ask him to do things the proper way.
This is outside of our forum support scope.
November 10, 2020 at 11:51 am #1525836ETOMost of the thins can be done by Hooks and the Snippets plugin. However, adding the necessary code to the 33rd line in inc/structure/archive.php is not possible by using Snippets plugin.
November 10, 2020 at 1:10 pm #1525888LeoStaffCustomer SupportWhat is that code for?
November 10, 2020 at 7:25 pm #1526144Thiago SennaHi,
every code in
inc/structure/archive.php
are added by using hooks. If it’s added by hook so it can be removed too using theremove_action
functionhttps://developer.wordpress.org/reference/functions/remove_action/
so it’s possible for your developer just to remove a hooked function and replace it with another function using only child-theme or the code snippets plugin
November 22, 2020 at 3:15 am #1540803ETOWhat is that code for?
Hi Leo! You can see what it is for by looking at the file I sent you.
Hi,
every code in inc/structure/archive.php are added by using hooks. If it’s added by hook so it can be removed too using theremove_action function
https://developer.wordpress.org/reference/functions/remove_action/
so it’s possible for your developer just to remove a hooked function and replace it with another function using only child-theme or the code snippets plugin
How is it possible to add code in
inc/structure/archive.php
by using hooks?November 22, 2020 at 8:23 am #1541237Thiago SennaCan you provide to us what kind of code you want to add and what line in
inc/structure/archive.php
you want to change?Here is the archive you want to change if you need to remember where exactly you want to modify –
https://github.com/tomusborne/generatepress/blob/master/inc/structure/archives.phpWe need to understand better what you want – it’s very easy you to remove a hook in favor of a new hook but breaks existing functionality.
Theses hooks are the most safe for you to hook into:
https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/archives.php#L31
https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/archives.php#L46
https://github.com/tomusborne/generatepress/blob/3.0.2/inc/structure/archives.php#L116Here a code sample if I want to add a description after archive title (line 46) – this code should be added in your child-theme’s functions.php
add_action( 'generate_after_archive_title', 'generatepress_child_custom_archive_description' ); function generatepress_child_custom_archive_description() { echo '<p>here goes a custom archive description</p>'; }
Here a more detailed documentation about hooks
November 23, 2020 at 10:19 am #1542783ETOHi, Thiago!
You can see all the customizations we made to the theme here. -
AuthorPosts
- You must be logged in to reply to this topic.