WordPress.org

Ready to get started?Download WordPress

Forums

Altering .php files (3 posts)

  1. words2us
    Member
    Posted 2 years ago #

    I want to make changes to some .php files on my domain, but I was just wondering whether any changes I made directly to these files would be lost if the theme I am using is reinstalled or updated. At the moment I am using a child theme with a style.css that imports the code for the style.css in the parent theme, but is it possible to do the same with .php files and just make a sidebar.php in my child theme and import the code from the sidebar.php from the parent theme, for example?

    Sorry if I'm not explaining myself very well or I'm asking a stupid question, but I'm new to all this.

  2. I was just wondering whether any changes I made directly to these files would be lost if the theme I am using is reinstalled or updated.

    If you modified core files and/or parent theme files, yes the changes would be lost when an update happens.

    At the moment I am using a child theme with a style.css that imports the code for the style.css in the parent theme, but is it possible to do the same with .php files and just make a sidebar.php in my child theme and import the code from the sidebar.php from the parent theme, for example?

    Not import, but make duplicate copies of the parent theme files that you want to modify and put those copies into your child theme directory.

    As long as the files are standard template file names or loaded via get_template_part() then your child theme's copies will be loaded instead of the parent theme copies.

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

    Sorry if I'm not explaining myself very well or I'm asking a stupid question, but I'm new to all this.

    Nope, it's all good. :)

  3. words2us
    Member
    Posted 2 years ago #

    Thanks Jan, that's really helped. :)

Topic Closed

This topic has been closed to new replies.

About this Topic