Problem integrating with WP eMember
-
Hi Dumitru,
I have a child theme and one of the things I have in it is an override of the header.php file. I do this because I need to be able to switch header menus based one whether a member of our society is logged on or not. (There is one menu for members and a different one for nonmembers.) Prior to 1.6 I was able to do this by following these instructions from WP eMember:
However, since 1.6 you do something different for mobile (in the mobile-menu.php template part). The original modification to header.php works fine on laptops, desktops and tablets, but the menus don’t switch on logging on with a smart phone. I was able to work around it by modifying mobile-menu.php, but I hate messing with your core code – which is why I use a child theme.
Can you suggest a better way for me to accomplish this so I can do it with my child theme so I won’t have my modification blown out of the water when you release the next update?
Thanks for all you do!!!
Don Worth
Ventura County Genealogical Society—————
PART OF HEADER.PHP
<div id=”site-header-navigation”>
<nav id=”menu-main”>
<?php
if ( wp_emember_is_member_logged_in() ) {
wp_nav_menu( array(
‘container’ => ”,
‘container_class’ => ”,
‘menu_class’ => ‘dropdown’,
‘menu_id’ => ‘menu-main-menu’,
‘sort_column’ => ‘menu_order’,
‘theme_location’ => ‘primary’,
‘menu’ => ‘members’,
‘link_after’ => ”,
‘items_wrap’ => ‘<ul id=”site-primary-menu” class=”large-nav sf-menu”>%3$s‘ ) );
} else {
wp_nav_menu( array(
‘container’ => ”,
‘container_class’ => ”,
‘menu_class’ => ‘dropdown’,
‘menu_id’ => ‘menu-main-menu’,
‘sort_column’ => ‘menu_order’,
‘theme_location’ => ‘primary’,
‘menu’ => ‘nonmembers’,
‘link_after’ => ”,
‘items_wrap’ => ‘<ul id=”site-primary-menu” class=”large-nav sf-menu”>%3$s‘ ) );
}
?>
</nav><!– #menu-main –></div><!– #site-header-navigation –>
PART OF MOBILE-MENU.PHP
<nav class=”mobile-menu” aria-label=”<?php esc_attr_e( ‘Mobile Menu’, ‘edupress’ ); ?>”>
<?php
if ( $mobile_menu_location ) {If ( wp_emember_is_member_logged_in() ) {
wp_nav_menu(
array(
‘container’ => ”,
‘items_wrap’ => ‘%3$s’,
‘show_toggles’ => true,
‘theme_location’ => $mobile_menu_location,
‘menu’ => ‘members’,
‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s”>%3$s‘
)
);
} else {
wp_nav_menu(
array(
‘container’ => ”,
‘items_wrap’ => ‘%3$s’,
‘show_toggles’ => true,
‘theme_location’ => $mobile_menu_location,
‘menu’ => ‘nonmembers’,
‘items_wrap’ => ‘<ul id=”%1$s” class=”%2$s”>%3$s‘
)
);
}
}
?>
</nav><!– .mobile-menu –>
- The topic ‘Problem integrating with WP eMember’ is closed to new replies.