Magento2 – How to Change Code in Extension Without Editing Files Directly

magento2templatethird-party-module

I want to make changes to a 3rd party extension (it happens to be the FishPig WordPress extension) but I don't want to edit the files in the extension directly so that I can add updates to the extension easily in the future.

I have a feeling that I should be able to drop files into my custom theme using the same file structure that the template uses but I can't figure out how to get it to work.

e.g. I want to change the file:

app/code/FishPig/WordPress/view/frontend/templates/post/list/renderer/default.phtml

Can I just create the following file to change it (I'm guessing not as it doesn't seem to work):

app/design/vendor/mytheme/view/frontend/templates/post/list/renderer/default.phtml

I'm sure that there is a simple solutions but I can't figure it out.

Best Answer

You need to create Vendor_Module folder in your custom theme

For example to copy this file

app/code/FishPig/WordPress/view/frontend/templates/post/list/renderer/default.phtml

You need to follow this path

app/design/frontend/Vendor/theme/FishPig_WordPress/templates/post/list/renderer/default.phtml