1

I am trying to override some Mageplaza 2 Blog Extension template .phtml files

(for this question lets focus on topmenu.html)

Before you downvote me, I read a tone of answers and tried implementing them, and nothing worked

I am a complete magento2 newbie whatever I know is mostly assumptions and whatever I experienced in my magento2 journey so far

My Vendor Name: C2ghq

My theme Name: c2g

What I tried so far and didn't work:

app/design/frontend/C2ghq/c2g/Mageplaza_BlogExtension/templates/html/topmenu.html
app/design/frontend/C2ghq/c2g/Mageplaza_Blogextension/templates/html/topmenu.html
app/design/frontend/C2ghq/c2g/Mageplaza_2BlogExtension/templates/html/topmenu.html
app/design/frontend/C2ghq/c2g/Mageplaza_Magento2BlogExtension/templates/html/topmenu.html
app/design/frontend/Mageplaza/c2g/Mageplaza_BlogExtension/templates/html/topmenu.html


In the vendor folder the extension has:

/vendor/mageplaza/magento-2-blog-extension

/vendor/mageplaza/module-core

What confuses me:

Magento's modules folder, has i.e. module-product, so the prefix is indeed "module", so if i want to override it, I do

app/design/frontend/C2ghq/c2g/Magento_Product/templates/...

But Mageplaza has magento-2-blog-extension, is it also considered a module?


*And finally: What am I doing wrong?

Edit: registration.php file:

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mageplaza_Blog',
    __DIR__
);
  • Have flush cache and delete all files from var/view_procecessed ? – Amit Bera Oct 11 '17 at 9:12
  • 1
    can you let me know which name defined under registration.php file? – Rakesh Jesadiya Oct 11 '17 at 9:12
  • 1
    Can u please share code of vendor/mageplaza/magento-2-blog-extension\registration.php – Amit Bera Oct 11 '17 at 9:13
  • 2
    @Rakesh, you are faster then me :) – Amit Bera Oct 11 '17 at 9:13
  • @AmitBera i have cache disabled, do i still need to delete all files? – hahaha Oct 11 '17 at 9:34
2

By Default, Any module with required mandatory registration.php file to run your module in site.

registration.php is entry point for each module.

If you are confused with module name, you just go to your module registration.php file. like,

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mageplaza_Blog',
    __DIR__
);

In above file content, Mageplaza_Blog is your module name and based on this module name you can extend/override theme templates to your theme.

You need to do like below, Your module name is Mageplaza_Blog

app/design/frontend/C2ghq/c2g/Mageplaza_Blog/templates/html/topmenu.html
| improve this answer | |
  • Thanks! I guess its also important to say in the answer where to find such information, every answer i ve read doenst mention registration.php, to a newbie like me its probably not so obvious to check it! If you can include it maybe the next one wont ask a new question. Maybe if possible add a more general answer. Though i accepted your answer as the correct one :D – hahaha Oct 11 '17 at 9:45
  • @Alexandros, Kindly check i have updated my answer. – Rakesh Jesadiya Oct 11 '17 at 9:53
  • You are the best :D – hahaha Oct 11 '17 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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