• Hi,

    Hoping someone can assist but I am working off a child theme where I currently just have a style.css file.

    My question and am a little confused if this is possible and the correct way of doing this, but I have just noticed that one of the pages within my WordPress site using this parent/child theme setup has some code that I need to change within the loop.php file, which currently resides within the parent theme directory – what is the best approach to change this and can I actually take a copy of the original loop.php file from the parent directory and use this within my child theme directory?

    Is the above possible – if not, how would I go about changing the code within the loop.php file?

    Thanks.
    SP.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Yes, copy the loop.php file into your child theme (via FTP) and then make changes via the editor. Or use a text editor to make changes on your local machine and upload the edited version to the child theme.

    Basically, you “override” a file in the parent theme by creating a file of the same name in the child theme. So, if you want to override the loop.php file, then just create this file inside your child theme or better yet, copy the one from the parent theme and modify the copy instead.

    So now, you’ll have style.css and loop.php within your child theme.

    Thread Starter softprinciples

    (@softprinciples)

    Excellent – thanks for that.

    Just a few other questions please on this parent-child theme file setup.

    Does this mean that any file that is in the parent theme, be it at root level or within a directory within the parent theme can be “overriden” within the child theme, like loop.php?

    A specific example I have is that I also need to modify a file within the parent theme that exists within the directory “parent_theme/include/widgets” – does this mean that I need to create this same directory structure within my child theme directory, i.e. “child_theme/include/widgets” and then place the file I want to update here?

    If you could please get back to me on the above, that would be great and if there are any useful links that people can point me to that explains the above, that would also be useful.

    Thanks.
    SP.

    Thread Starter softprinciples

    (@softprinciples)

    Hi,

    Any response to my last post, before this one?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Modifying the LOOP.PHP file – How?’ is closed to new replies.