[Resolved] Do custom theme files create issues with frequent GP updates?

Home Forums Support [Resolved] Do custom theme files create issues with frequent GP updates?

Home Forums Support Do custom theme files create issues with frequent GP updates?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #139884
    Mo

    Hi Tom,
    Please bear with me as I try to explain the question.

    With themes previously used, if/when custom theme files were made and added to a child theme such as templates or header.php, footer, page.php, single.php, index.php, sidebar.php, etc. there werwn’t any quams regarding missing out on the benefits of theme updates. For the most part there just weren’t updates occurring often enough to be concerned about it.

    GP and GP Premium are a different story. In your quest for theme optimization and bug fixes, there seem to be frequent updates occurring at least every 2 weeks or less. Correct me if I’m wrong on that. That’s true commitment which makes GP and GP premium and exceptional product.

    The concern is that if custom files are placed in the child theme to avoid being overwritten, will they degrade the continuing improvements made to the overall theme?

    Performance and SEO with regard to Google are ongoing so having a theme performing optimally is critical. Page load time and being W3C compliant may not directly affect SERPS but it certainly has an impact on the user experience.

    With Google putting the emphasis on delivering the best experience for mobile devices it’s a priority that needs constant monitoring.

    For example, you’re aware that there’s a custom footer.php on my site to accommodate the tertiary menu. Will it eventually suffer performance or bug issues by not being updated with the rest of the theme?

    Initially I was manually transposing the custom code to the updated footer and then placing it in the child theme. This was probably unnecessary which is why I’m seeking confirmation.

    If this concern is unclear, please ask for clarification.

    Thanks once again for your superb efforts and support.

    #139898
    Tom
    Lead Developer
    Lead Developer

    Hi Mo,

    Short answer – it can.

    As I’m always updating things, if you’re overwriting certain files in your child themes, you’ll miss those updates.

    Missing those updates probably won’t hurt your performance, but you will miss out on small fixes and improvements.

    This is why I prefer the use of hooks over using custom child theme files.

    With hooks, you place your code (menu in this example) in a function, and then hook it into the theme.

    For example, if you wanted to add something before the footer:

    add_action( 'generate_before_footer','generate_add_code_before_footer' );
    function generate_add_code_before_footer()
    { ?>
          Everything inside this area will be added before the footer. Anything and everything can go in here.
    <?php }

    You can see a full list of our hooks here: https://generatepress.com/knowledgebase/hook-list/

    Otherwise, you can just pay attention to our changelogs for each update. I’ll mention if specific template files have been changed. If you see that I’ve made a change to a file you have in your child theme, you can review the file and make the change if necessary.

    I personally prefer the hook method.

    Let me know if you need more info! πŸ™‚

    #140504
    Mo

    Hi Tom,
    Thanks for the response.
    I didn’t get an email in my box about your response so sorry for the lag.

    ====

    That makes perfect sense.

    I wondered about using hooks.

    Since this site is currently in development mode, it would offer the perfect opportunity to try them out.

    If things don’t work, I’ll contact you.

    Thanks again.

    #140511
    Mo

    Using hooks would seem the preferable and efficient manner of custom coding.

    The “add action” string you’ve used is the usual way to apply the code in hooks?

    My knowledge of php is minimal.

    It appears that the proper syntax could probably be found in the theme files and then applied in the hook?

    ===

    CSS is still applied through the style file and not the hooks?

    Thanks.

    #140512
    bdbrown

    If you’re interested here is a good introduction to actions, hooks and filters.

    #140531
    Tom
    Lead Developer
    Lead Developer

    The first string in the add_action function is the hook name (found on the link I posted).

    The second part is the function name.

    Simplified:

    add_action('generatepress_hook_name','my_function_name');
    function my_function_name()
    { ?>
        My hooked content
    <?php }
    #140666
    Mo

    Thanks for the info Tom & bdbrown.

    I believe I’ve seen bdbrown helping out on wordpress.org’s support forum.

    Coincidentally I was just checking out the filters page this morning and wondered if it might be useful in some capacity for the current and future builds.

    Now I can find out.

    ===

    Wouldn’t the world be better place if it was run like GP! πŸ™‚

    #140694
    Tom
    Lead Developer
    Lead Developer

    Glad we could help, Mo! πŸ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.