17 January

Adding a CMS Page to your theme navigation menu

: 1 Comments
pagelink

Hi folks!, enjoying your #Magento store?, let me give you a very useful tip: how to add a cms page into my theme’s nav-menu?:

1) First we create our CMS page through our Admin-panel: CMS->Pages

cms

Keep in mind the “URL Key” field will be displayed in the full URL of your page.

2) Now we add a line of code which will call our CMS page in the top-navigation of the theme. Since i’m doing this in HelloLoja Theme, let’s open up template/hellothemes/navigation/top.phtml file.

3) We take a look at this file and locate the line where the menu is called, in this case:  “echo $_menu” on line 17.

4) Now using Firebug tool, we take a look at the html structure of the theme’s navigation menu:

firebug

5) We can see there’s a list with a link and a span tag inside:

6) So now we add this next to the “echo $_menu” sentence pointed before:

Notice that we add a “,” next to $_menu, this is to add another line or variable to be displayed (echo) in the frontend. We also add the full URL to our page in the href=”" attribute without .html, and the name of the page between <span> tag.

7) That’s all!, our CMS page link is displayed in our navigation menu:

pagelink

 

You can take a look at the file (top.phtml) here if you need to:

 

Hope this helps!! Cheers! :D

  • https://www.gomage.com/ Chris Mclean

    Great tips, very helpful! Thanks a lot for sharing the info, good work!

Back to Top