Skip to content

Instantly share code, notes, and snippets.

@navalon
Forked from srikat/functions.php
Created October 29, 2016 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navalon/c9ae7b9844634dcd0f6ad56beaec4a81 to your computer and use it in GitHub Desktop.
Save navalon/c9ae7b9844634dcd0f6ad56beaec4a81 to your computer and use it in GitHub Desktop.
How to reposition Primary Navigation conditionally in Genesis. https://sridharkatakam.com/how-to-reposition-primary-navigation-conditionally-in-genesis/
<?php
// Reposition the primary navigation menu conditionally
add_action( 'genesis_before', 'sk_resposition_primary_nav' );
function sk_resposition_primary_nav() {
// if we are not on a single Post page or archive page or search results page, abort.
if ( ! ( is_singular( 'post' ) || is_archive() || is_search() ) ) {
return;
}
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment