Refactor footer navigation retrieval logic

Prevent:

Warning: Undefined array key "footer_navigation" in /Users/will/Local Sites/banffs-indigenous-experiences-map/app/public/wp-content/themes/Banff/footer.php on line 19

Warning: Undefined property: WP_Error::$term_id in /Users/will/Local Sites/banffs-indigenous-experiences-map/app/public/wp-content/themes/Banff/footer.php on line 20
This commit is contained in:
willpalahnuk
2026-01-30 18:00:56 -06:00
committed by GitHub
parent b5c3c5d6d0
commit dc33dea120

View File

@@ -16,8 +16,9 @@ $copyright_text = getFieldValue( 'footer.copyright_text' ) ? getFieldValue( 'foo
$copyright = str_replace( '%Y', gmdate( 'Y' ), $copyright_text ); $copyright = str_replace( '%Y', gmdate( 'Y' ), $copyright_text );
$locations = get_nav_menu_locations(); $locations = get_nav_menu_locations();
$footerMenu = get_term( $locations['footer_navigation'], 'nav_menu' ); $footerNav = ! empty( $locations['footer_navigation'] )
$footerNav = wp_get_nav_menu_items( $footerMenu->term_id ); ? ( wp_get_nav_menu_items( (int) $locations['footer_navigation'] ) ?: [] )
: [];
?> ?>
</main> </main>