This tutorial provides the steps to modify the code so you can conditionally remove the social menu from specific pages in Authority Pro.
Based on this question from a member of the Genesis community :
I need to conditionally remove / hide the Social Menu (along left hand side of page) for a specific page. The conditional argument is no problem, however I cannot find the hook for the social menu and the do_action argument for the social menu.
Demo Video #
Shows how to add a conditional tag to the existing function authority_do_social_menu
in order to remove the social menu from displaying on specific pages.
Code Modification #
In the Authority Pro themes functions file, you’ll find the PHP code for the social menu between lines 276 – 293 which adds the third menu on all pages of the Authority Pro theme.
add_action( 'genesis_before_header', 'authority_do_social_menu', 9 );
function authority_do_social_menu() {
echo '<h2 id="additional-menu-label" class="screen-reader-text">' . __( 'Additional menu', 'authority-pro' ) . '</h2>';
genesis_nav_menu(
array(
'theme_location' => 'social',
'depth' => 1,
)
);
}
There’s only 1 step. Add your conditional tag after the function name like you see in the following modified code :
add_action( 'genesis_before_header', 'authority_do_social_menu', 9 );
function authority_do_social_menu() {
if ( is_front_page() )
return;
echo '<h2 id="additional-menu-label" class="screen-reader-text">' . __( 'Additional menu', 'authority-pro' ) . '</h2>';
genesis_nav_menu(
array(
'theme_location' => 'social',
'depth' => 1,
)
);
}
In this case, we’ve added the following conditional check to remove the social menu from the front page :
if ( is_front_page() )
return;
You can swap out the is_front_page
conditional tag and use any other conditional tag to remove the social menu from any page or post.
Test