This article is for AMP Theme Framework users.
About this Component
Menu Component is for setting the Menu in your AMP theme.
How to use:
Following are the steps to use this component.
Step 1:
To initiate the support for the component in your theme just add the following code to the functions.php of the theme files.
//Menu add_amp_theme_support('AMP-menu');
This was the back-end part where we’ve just initiated, now to make it appear in the front-end follow the next step.
Step 2:
To add the Menu we need to call it where we wanted to set it.
example: add the following code in header.php of the theme files.
<?php amp_menu(); ?>
with this, you’re successfully able to set Menu on your theme.
That’s it for this tutorial!
We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.
Hello,
I am creating custom theme,and installed basic framework theme you provided, Can you please let me know, how we can add the class in amp_menu(); as i need to add my class in ul tag.
Thanks.
Hi Rahul,
Will you please add this code instance of –
‘amp-menu’,
‘container’=>’aside’,
‘menu’=>’ul’,
‘menu_class’=>’amp-menu ADDYOURCLASSES’,
‘echo’ => false,
‘walker’ => new Ampforwp_Walker_Nav_Menu()
);
amp_menu( true, $menu_args, ‘menu’ ); ?>
you need to add this code in Amp theme framework -> header.php like this screenshot- https://monosnap.com/file/DYw8cLJv7LwEtfyVwi1y1AuZil1csQ and if you have issue/problem then contact our support team – https://ampforwp.com/support/ they will help you and fix the issue as soon as possible.
Hi, I followed the 2 steps but I have a problem:
Step 1) I added the script “// Menu
add_amp_theme_support (‘AMP-menu’); “at the end of the function.php file of my theme WP (PenNews by Pencil > llink: https://themeforest.net/item/pennew-multiconcept-newsmagazine-amp-wordpress-theme/20822517).
I see that in the function.php file of Amp theme Framework this script is already inserted.
Step 2) Then I added the script “” To the end of the Header.php file of my theme (PenNews by Pencil).
I see again that even in the Header.php file of Amp theme Framework this script is already inserted.
So why doesn’t it work and don’t load my menu?
my website: https://synapticweb.it/synapticweb.
Thanks 4 you help
Hi Gianluca Corsini,
We have checked your website and found that menu display like below the screenshot – https://take.ms/rQjJ1 and if you have issue/problem then contact our technical team – https://ampforwp.com/support/ they will help you as soon as possible.
I also tried but did not understand.