footer-menus-widgets.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Displays the menus and widgets at the end of the main element.
  4. * Visually, this output is presented as part of the footer element.
  5. *
  6. * @package WordPress
  7. * @subpackage Twenty_Twenty
  8. * @since Twenty Twenty 1.0
  9. */
  10. $has_footer_menu = has_nav_menu( 'footer' );
  11. $has_social_menu = has_nav_menu( 'social' );
  12. $has_sidebar_1 = is_active_sidebar( 'sidebar-1' );
  13. $has_sidebar_2 = is_active_sidebar( 'sidebar-2' );
  14. // Only output the container if there are elements to display.
  15. if ( $has_footer_menu || $has_social_menu || $has_sidebar_1 || $has_sidebar_2 ) {
  16. ?>
  17. <div class="footer-nav-widgets-wrapper header-footer-group">
  18. <div class="footer-inner section-inner">
  19. <?php
  20. $footer_top_classes = '';
  21. $footer_top_classes .= $has_footer_menu ? ' has-footer-menu' : '';
  22. $footer_top_classes .= $has_social_menu ? ' has-social-menu' : '';
  23. if ( $has_footer_menu || $has_social_menu ) {
  24. ?>
  25. <div class="footer-top<?php echo $footer_top_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
  26. <?php if ( $has_footer_menu ) { ?>
  27. <nav aria-label="<?php esc_attr_e( 'Footer', 'twentytwenty' ); ?>" role="navigation" class="footer-menu-wrapper">
  28. <ul class="footer-menu reset-list-style">
  29. <?php
  30. wp_nav_menu(
  31. array(
  32. 'container' => '',
  33. 'depth' => 1,
  34. 'items_wrap' => '%3$s',
  35. 'theme_location' => 'footer',
  36. )
  37. );
  38. ?>
  39. </ul>
  40. </nav><!-- .site-nav -->
  41. <?php } ?>
  42. <?php if ( $has_social_menu ) { ?>
  43. <nav aria-label="<?php esc_attr_e( 'Social links', 'twentytwenty' ); ?>" class="footer-social-wrapper">
  44. <ul class="social-menu footer-social reset-list-style social-icons fill-children-current-color">
  45. <?php
  46. wp_nav_menu(
  47. array(
  48. 'theme_location' => 'social',
  49. 'container' => '',
  50. 'container_class' => '',
  51. 'items_wrap' => '%3$s',
  52. 'menu_id' => '',
  53. 'menu_class' => '',
  54. 'depth' => 1,
  55. 'link_before' => '<span class="screen-reader-text">',
  56. 'link_after' => '</span>',
  57. 'fallback_cb' => '',
  58. )
  59. );
  60. ?>
  61. </ul><!-- .footer-social -->
  62. </nav><!-- .footer-social-wrapper -->
  63. <?php } ?>
  64. </div><!-- .footer-top -->
  65. <?php } ?>
  66. <?php if ( $has_sidebar_1 || $has_sidebar_2 ) { ?>
  67. <aside class="footer-widgets-outer-wrapper" role="complementary">
  68. <div class="footer-widgets-wrapper">
  69. <?php if ( $has_sidebar_1 ) { ?>
  70. <div class="footer-widgets column-one grid-item">
  71. <?php dynamic_sidebar( 'sidebar-1' ); ?>
  72. </div>
  73. <?php } ?>
  74. <?php if ( $has_sidebar_2 ) { ?>
  75. <div class="footer-widgets column-two grid-item">
  76. <?php dynamic_sidebar( 'sidebar-2' ); ?>
  77. </div>
  78. <?php } ?>
  79. </div><!-- .footer-widgets-wrapper -->
  80. </aside><!-- .footer-widgets-outer-wrapper -->
  81. <?php } ?>
  82. </div><!-- .footer-inner -->
  83. </div><!-- .footer-nav-widgets-wrapper -->
  84. <?php } ?>