Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Simplify the mobile menu files #770

Merged
merged 2 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions newspack-theme/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
<?php do_action( 'wp_body_open' ); ?>
<?php do_action( 'before_header' ); ?>

<?php
if ( newspack_is_amp() ) {
get_template_part( 'template-parts/header/mobile', 'sidebar' );
} else {
get_template_part( 'template-parts/header/mobile', 'sidebar-fallback' );
}
?>
<?php get_template_part( 'template-parts/header/mobile', 'sidebar' ); ?>

<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'newspack' ); ?></a>
Expand Down

This file was deleted.

38 changes: 24 additions & 14 deletions newspack-theme/template-parts/header/mobile-sidebar.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
<?php
/**
* Template for display the AMP mobile navigation.
* Template to display the mobile navigation, either AMP or fallback.
*
* @package Newspack
*/
?>

<amp-sidebar id="mobile-sidebar" layout="nodisplay" side="right" class="mobile-sidebar">
if ( newspack_is_amp() ) : ?>
<amp-sidebar id="mobile-sidebar" layout="nodisplay" side="right" class="mobile-sidebar">
<button class="mobile-menu-toggle" on='tap:mobile-sidebar.toggle'>
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php else : ?>
<aside id="mobile-sidebar-fallback" class="mobile-sidebar">
<button class="mobile-menu-toggle">
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php endif; ?>

<button class="mobile-menu-toggle" on='tap:mobile-sidebar.toggle'>
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php newspack_tertiary_menu(); ?>

<?php newspack_tertiary_menu(); ?>
<?php get_search_form(); ?>

<?php get_search_form(); ?>
<?php newspack_primary_menu(); ?>

<?php newspack_primary_menu(); ?>
<?php newspack_secondary_menu(); ?>

<?php newspack_secondary_menu(); ?>
<?php newspack_social_menu_header(); ?>

<?php newspack_social_menu_header(); ?>

</amp-sidebar>
<?php if ( newspack_is_amp() ) : ?>
</amp-sidebar>
<?php else : ?>
</aside>
<?php endif; ?>