Support » Theme: Twenty Twenty-One » can’t get theme support to work for search form

  • I’m on WordPress 5.9.2 and using TwentyTwentyOne version 1.5

    I have a very odd situation within my child theme, in which the built in search form is not converting to HTML5 syntax.

    From my child theme I have the following files

    – style.css
    – screenshot.png
    – functions.php
    – front-page.php

    Within my functions.php, I have the following code:

    function _ags_after_setup_theme() {
      add_theme_support( 'html5', array( 'search-form' ) );
    }
    add_action( 'after_setup_theme', '_ags_after_setup_theme' );

    Within my font-page.php I have the following code :

    *
     * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
     *
     * @package WordPress
     * @subpackage Twenty_Twenty_One
     * @since Twenty Twenty-One 1.0
     */
    
    get_header();
    ?>
    
    <!--_ags - THE FRONT PAGE SEARCH TEST-->
    <p>the beginning of our front page content</p>
    <div class="search-form-container">
      <?php get_search_form(); ?>
    </div>
    
    <?php
    get_footer();

    And when I go to my front page, the search form still looks like the following syntax:

    <form role="search" method="get" class="search-form" action="http://nffa.agx:49206/">
    	<label for="search-form-1">Search…</label>
    	<input type="search" id="search-form-1" class="search-field" value="" name="s">
    	<input type="submit" class="search-submit" value="Search">
    </form>

    Why is that? Shouldn’t there by placeholder, and elements wrapped in the label element?

    • This topic was modified 6 months, 2 weeks ago by klewis.
  • The topic ‘can’t get theme support to work for search form’ is closed to new replies.