So I am trying to call the genesis_do_nav hook so its only on the front page and the homepage. For some reason it doesn't work unless I do
add_action( 'genesis_entry_header', 'genesis_do_nav' );
But that is going to execute the menu on the entry header globally which is exactly what I am trying to avoid. Any suggestions
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_entry_header', 'menu_only_on_homepage' );
function menu_only_on_homepage() {
if( is_home() && is_front_page() ){
genesis_do_nav();
}
}
Two Ideas I would like you to try:
A. First Issue I see is with your condition i.e. is_home() && is_front_page()
I think this condition will never be true as both are different pages. So maybe you wanted to have it is_home() || is_front_page()
B. Try Re Arranging the code, Try arranging your conditional in different order so that you have condition before you add the hook i.e.
if(is_home() || is_front_page() ){
add_action( 'genesis_entry_header', 'genesis_do_nav' );
}
See if it helps in your situation please note code is untested as I wrote here so first test it on dev environment before trying on live so you could easily fix any typos or syntax errors.