Making WordPress.org


Ignore:
Timestamp:
05/20/2015 06:03:56 PM (11 years ago)
Author:
coffee2code
Message:

jobs.wordpress.net: Add support for defining help text for job form input fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/jobs.wordpress.net/public_html/wp-content/plugins/jobswp/jobswp-template.php

    r169 r1603  
    112112 * Outputs the text field input and surrounding markup.
    113113 *
    114  * @param string $field_name The field name/key
    115  * @param string $field_label The label text
    116  * @param boolean $required Is the field a required input?
    117  * @param string $type The HTML5 input type. Default is 'text'.
    118  * @return string
    119  */
    120 function jobswp_text_field( $field_name, $field_label, $required = false, $type = 'text' ) {
     114 * @param string $field_name  The field name/key.
     115 * @param string $field_label The label text.
     116 * @param bool   $required    Is the field a required input? Default false.
     117 * @param string $type        The HTML5 input type. Default 'text'.
     118 * @param string $help_text   Help text for the input. Default ''.
     119 * @return string
     120 */
     121function jobswp_text_field( $field_name, $field_label, $required = false, $type = 'text', $help_text = '' ) {
    121122        $field_name  = esc_attr( $field_name );
    122123        $field_label = esc_html( $field_label );
     
    136137                ( $required ? ' required' : '' ) .
    137138                " />\n";
     139
     140        if ( $help_text ) {
     141                echo '<div class="job-help-text">' . $help_text . "</div>\n";
     142        }
     143
    138144        echo "</div>\n";
    139145}
Note: See TracChangeset for help on using the changeset viewer.