• mhs0

    (@mhs0)


    Hi,

    AMP for WP – Accelerated Mobile Pages is a great plugin, thanks! I added a menu to AMP menu. Is it supposed to redirect to other AMP pages automatically, or do I need to create a new menu that explicitly points to the AMP versions of the pages?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hey @mhs0

    Thank you so much for using the plugin.

    The Navigation menus is setup by you from the WordPress Admin area. So, we cannot control the menu items that you will add so if you want the users to redirect to AMP pages then you will have to add the custom menu items by adding the AMP link of the pages.

    I hope it helps,

    Regards,
    Ahmed

    Thread Starter mhs0

    (@mhs0)

    Thanks for your reply!

    Ok, got it. A future feature might be to auto-append /amp at the end of internal links.

    Thanks again!

    Thread Starter mhs0

    (@mhs0)

    BTW, if anyone else wants to do this, you can add the following code to “accelerated-mobile-pages/templates/header.php” via the plugin editor. It will append “/?amp” to the end of every menu link:

    <div role=”button” tabindex=”0″ on=’tap:sidebar.close’ class=”close-nav”>X</div>

    <?php /* INSERT NEW CODE STARTING HERE */ ?>
    <?php function add_menu_atts( $atts, $item, $args ) {
    $atts[‘href’] .= “/?amp”;
    return $atts;
    }
    add_filter( ‘nav_menu_link_attributes’, ‘add_menu_atts’, 10, 3 );
    ?>
    <?php /* END OF NEW CODE */ ?>

    <?php wp_nav_menu( array( ‘theme_location’ => ‘amp-menu’ ) ); ?>

    Khaled

    (@azmak)

    Thanx mhsO for the solution ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘AMP Menu doesn’t link to AMP pages’ is closed to new replies.