• Resolved miocene22

    (@miocene22)


    I’m creating a theme and have used the function <?php get_search_form(); ?>

    Problem is it generates a form with a role attribute which does not validate with xhtml 1.0.

    How do I solve this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Create your own search form template file in your theme. WP will use it automatically. The easiest way to do this is to grab the source code for the currently invalid form (and only the form), drop it into a text editor, remove the role attribute, save the file as searchform.php and upload to your theme.

    Thread Starter miocene22

    (@miocene22)

    Thanks fr your reply.
    ok, where can I find the source for the invalid form?

    Go to one of your theme’s pages where you’re using <?php get_search_form(); ?>/ Right click – View Page Source. Copy everything from the opening <form> to the closing </form>.

    Thread Starter miocene22

    (@miocene22)

    nice, thank you

    I think it’s a bug:

    It definitely is a bug. Its in the general-template.php file:
    $form = ‘<form role=”search” method=”get” id=”searchform” action=”‘ . get_option(‘home’) . ‘/” >

    Unfortunately, in the Classic theme there is no search searchform.php. I’ll check to see if adding one will fix the problem. I’m using all widgets so not sure how it will impact whether or not the searchform.php file will be picked up.

    See:
    https://www.ads-software.com/support/topic/307502

    esmi: I followed your instructions and they worked like a charm!!! There was no searchform.php file before I created one by your instructions. I really didn’t think things would work or ‘validate’. Thank You!

    I also want to say that this was not the only ‘role’ attribute not validating. So I went through every page file in my themes folder and deleted the attribute everywhere it existed. Everything’s still working beautifully, and most importantly to me, validating.

    I just want to say thanks to all!

    Tracy

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘searchform role does not validate’ is closed to new replies.