1

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.

3
  • Do you copied the file on app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/template/html/ folder??
    – Asish Hira
    Apr 20, 2016 at 6:28
  • yes. I have given path fully like you said
    – Ramya
    Apr 20, 2016 at 6:35
  • check my answer
    – Asish Hira
    Apr 20, 2016 at 6:36

2 Answers 2

6

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.

12
  • Yeah I gave the path as you mentioned above.
    – Ramya
    Apr 20, 2016 at 6:44
  • run the command
    – Asish Hira
    Apr 20, 2016 at 6:45
  • 1
    Did you copy layout folder too?? If not then copy that file and paste it also on app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/.Try to enable template path hints and see that from where your template file is coming
    – Asish Hira
    Apr 20, 2016 at 7:47
  • 1
    Yes.You are absolutely correct. When I copied the needed part into my xml file which is already present in that folder, It worked. Thank you so much.
    – Ramya
    Apr 20, 2016 at 7:54
  • 1
    Welcome to community! Happy learning
    – Asish Hira
    Apr 20, 2016 at 7:55
3

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.

7
  • you can set topmenu.phtml file in above location which i have mentioned and check for changes. Its working. If not changes apply plz let me know. Apr 20, 2016 at 6:49
  • No the changes are not applied
    – Ramya
    Apr 20, 2016 at 6:53
  • 1
    have you created folder templates inside Magento_Theme, check spelling templates not only template. Apr 20, 2016 at 6:54
  • If I create it as templates my contents are disappearing.
    – Ramya
    Apr 20, 2016 at 6:57
  • run command php bin/magento setup:static-content:deploy Apr 20, 2016 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.