This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How to edit PHP files from a Child theme

  • Creator
    Topic
  • #6786
    darkecho
    Participant

    Thanks a lot for your help! Actually I re-installed my theme with the child theme and it works great, but how can I edit the php files through the child theme?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #6797
    Jason Bobich
    Keymaster

    Can you explain a little more what you mean because I think I may not be understanding? Do you mean how would you edit PHP files of your Child theme just in general?

    #6799
    darkecho
    Participant

    Yes, for example I would like to make modifications on the search.php file, is there any way to do it through the child theme or should i edit it from the actual theme?

    #6805
    Jason Bobich
    Keymaster

    Aw, okay I understand. So keep in mind the whole premise behind the Child theme is to not touch any part of the Parent theme. You’re essentially consolidating all of your edits to that Child theme.

    Just in general with WordPress Child themes, you’re able to edit any main template file that falls within the basic Template Hierarchy or anything included with get_template_part.

    http://codex.wordpress.org/Child_Themes#Template_files

    So, for example, you’d take search.php, copy from the Parent theme to your Child theme’s directory, and make your edits there. Now, because that file exists in your Child theme, WordPress will load it instead of the one in the Parent theme when it needs to load search.php.

    Also, note that specifically with this theme, copying content-search.php in this example, will provide you with a more simple file to edit.

    http://dev.themeblvd.com/tutorial/editable-content-files/

    Then, PHP edits beyond that, are where the fun starts. This is where you get into pluggable functions, actions, and filters.

    http://dev.themeblvd.com/tutorial_category/chapter-02/

    #6810
    Jason Bobich
    Keymaster

    [This question has been moved to its own topic]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The forum ‘Swagger Responsive WordPress Theme’ is closed to new topics and replies.