In magento 2 how to edit the phtml file?
-
29-09-2020 - |
Question
In magento 2 I need to edit topmenu.phtml
file. So I copied the topmenu.phtml
file from:
vendor/magento/module_theme/view/frontend/templates/html/topmenu.phtml
into:
app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html
and edited the file inside my theme module directory. But nothing changed. Someone please help me if am wrong.
Note: I have inherited Blank theme by copying all modules from
vendor/magento/theme-frontend-blank
into my theme directory.
Solution
Make sure that you paste the topmenu.phtml
file under app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/
folder!
Also copy the layout files which you need app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/layout
folder!
Then delete var
folder!
Then Run php bin/magento cache:flush
& php bin/magento setup:static-content:deploy
from your root directory!
Hope this will help you to solve your problem.
OTHER TIPS
You have to set topmenu.phtml
file inside below folder,
You have to just create templates
folder inside it.
app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/topmenu.phtml
Run commnad php bin/magento setup:static-content:deploy
clear var folder and try again.