WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] quiz.php code suggestion: <label>s (1 post)

  1. Peter Wilson
    Member
    Posted 4 years ago #

    I thought I'd share some changes I made to quiz.php to help with accessibility.

    Rather than wrapping the question is a span, it is wrapped in a label. An ID is generated if one isn't provided.

    Lines 43 - 44 have been replaced with

    if ( $id_att ) {
    		$atts .= ' id="' . trim( $id_att ) . '"';
    		$labelOpen = '<label for="' . trim( $id_att ) . '"';
    	}
    	else {
    		$atts .= ' id="_wpcf7_' . $name . '"';
    		$labelOpen = '<label for="_wpcf7_' . $name . '"';
    	}

    Line 69 (or line 75 with the above code) has been replaced with:

    $html = $labelOpen . ' class="wpcf7-quiz-label">' . esc_html( $question ) . '</label>&nbsp;';

    http://wordpress.org/extend/plugins/contact-form-7/

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Peter Wilson
  • This topic is not a support question
  • WordPress version: 2.9.1