Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Fix Off-Canvas Menu Bug #980

Merged
merged 3 commits into from
Apr 19, 2017
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
3 changes: 1 addition & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
<?php do_action( 'foundationpress_layout_end' ); ?>

<?php if ( get_theme_mod( 'wpt_mobile_menu_layout' ) === 'offcanvas' ) : ?>
</div><!-- Close off-canvas wrapper inner -->
</div><!-- Close off-canvas content -->
</div><!-- Close off-canvas wrapper -->
</div><!-- Close off-canvas content wrapper -->
<?php endif; ?>


Expand Down
5 changes: 2 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@

<?php if ( get_theme_mod( 'wpt_mobile_menu_layout' ) === 'offcanvas' ) : ?>
<div class="off-canvas-wrapper">
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<?php get_template_part( 'template-parts/mobile-off-canvas' ); ?>
<?php endif; ?>

<?php do_action( 'foundationpress_layout_start' ); ?>

<header id="masthead" class="site-header" role="banner">
<div class="title-bar" data-responsive-toggle="mobile-menu">
<button class="menu-icon" type="button" data-toggle="mobile-menu"></button>
<div class="title-bar" <?php foundationpress_title_bar_responsive_toggle() ?>>
<button class="menu-icon" type="button" data-toggle="<?php foundationpress_mobile_menu_id(); ?>"></button>
<div class="title-bar-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</div>
Expand Down
31 changes: 28 additions & 3 deletions library/foundation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function foundationpress_pagination() {
'type' => 'list',
) );

$paginate_links = str_replace( "<ul class='page-numbers'>", "<ul class='pagination'>", $paginate_links );
$paginate_links = str_replace( "<ul class='page-numbers'>", "<ul class='pagination text-center'>", $paginate_links );
$paginate_links = str_replace( '<li><span class="page-numbers dots">', "<li><a href='#'>", $paginate_links );
$paginate_links = str_replace( "<li><span class='page-numbers current'>", "<li class='current'><a href='#'>", $paginate_links );
$paginate_links = str_replace( '</span>', '</a>', $paginate_links );
Expand All @@ -35,9 +35,7 @@ function foundationpress_pagination() {

// Display the pagination if more than one page is found.
if ( $paginate_links ) {
echo '<div class="pagination-centered">';
echo $paginate_links;
echo '</div><!--// end .pagination -->';
}
}
endif;
Expand Down Expand Up @@ -157,3 +155,30 @@ function foundationpress_responsive_video_oembed_html( $html, $url, $attr, $post
}
add_filter( 'embed_oembed_html', 'foundationpress_responsive_video_oembed_html', 10, 4 );
endif;

/**
* Get mobile menu ID
*/

if ( ! function_exists( 'foundationpress_mobile_menu_id' ) ) :
function foundationpress_mobile_menu_id() {
if ( get_theme_mod( 'wpt_mobile_menu_layout' ) === 'offcanvas' ) {
echo 'off-canvas-menu';
} else {
echo 'mobile-menu';
}
}
endif;

/**
* Get title bar responsive toggle attribute
*/

if ( ! function_exists( 'foundationpress_title_bar_responsive_toggle' ) ) :
function foundationpress_title_bar_responsive_toggle() {
if ( ! get_theme_mod( 'wpt_mobile_menu_layout' ) || get_theme_mod( 'wpt_mobile_menu_layout' ) === 'topbar' ) {
echo 'data-responsive-toggle="mobile-menu"';
}
}
endif;

2 changes: 1 addition & 1 deletion template-parts/mobile-off-canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

?>

<nav class="off-canvas position-left" id="mobile-menu" data-off-canvas data-auto-focus="false" data-position="left" role="navigation">
<nav class="off-canvas position-left" id="<?php foundationpress_mobile_menu_id(); ?>" data-off-canvas data-auto-focus="false" role="navigation">
<?php foundationpress_mobile_nav(); ?>
</nav>

Expand Down