[Resolved] Does Short php snippet require Child Theme?

Home Forums Support [Resolved] Does Short php snippet require Child Theme?

Home Forums Support Does Short php snippet require Child Theme?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1516906
    Michelle

    When I tried to upload a snippet of php into my php functions via Filezilla, I got an error message saying I need to have a child theme, but your documentation says “if all you’ll be doing is adding CSS or PHP, a child theme probably isn’t necessary.”

    I researched and found a review of GeneratePress that said “One of the best features of GeneratePress is that you no longer have to use a child theme. You can update your GeneratePress theme using the Elements module. It allows you to add custom code/PHP and hooks anywhere throughout your WordPress site…”

    I also read “the only time you risk losing changes is when you make them to the parent theme files or use the Additional CSS field” but other documentation says “In WordPress 4.7, WordPress added a core way to add CSS to your site inside the Customizer which you can find in Customize > Additional CSS.”

    I am so confused. Do I need a child theme? I did not understand answers given to others on this forum that asked the same question.

    #1516938
    Elvin
    Staff
    Customer Support

    Hi,

    I researched and found a review of GeneratePress that said “One of the best features of GeneratePress is that you no longer have to use a child theme. You can update your GeneratePress theme using the Elements module. It allows you to add custom code/PHP and hooks anywhere throughout your WordPress site…”

    The author probably pertained to the Hook Element. And yes you can add your PHP snippets there.

    More on Hook Element here – https://docs.generatepress.com/article/hooks-element-overview/

    I am so confused. Do I need a child theme? I did not understand answers given to others on this forum that asked the same question.

    If you find creating a child theme a daunting task, you can use the Hook Element.

    Alternatively, you can install a Code Snippet plugin to add your PHP snippets.

    https://docs.generatepress.com/article/adding-php/#code-snippets

    To answer your question directly: No, child themes are NOT necessary for you to be able PHP snippets. 🙂

    #1516945
    Michelle

    Thank you for clarifying. I added a child theme, and am now removing it to use the hook element feature instead.

    #1516954
    Elvin
    Staff
    Customer Support

    Thank you for clarifying. I added a child theme, and am now removing it to use the hook element feature instead.

    No problem. 🙂

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