WordPress: Add Search Box Into Header

Navigate to Appearance > Theme Editor > select header.php > search for this section:

					<div id="site-header-menu" class="site-header-menu">
						<?php if ( has_nav_menu( 'primary' ) ) : ?>
							<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>">
								<?php
									wp_nav_menu(
										array(
											'theme_location' => 'primary',
											'menu_class' => 'primary-menu',
										)
									);
								?>
							</nav><!-- .main-navigation -->

Insert this:

						<div class="header-search">
							<?php get_search_form(); ?>
						</div>

Leave a Reply

Your email address will not be published. Required fields are marked *