Created
November 15, 2018 17:06
-
-
Save tripflex/063f4e7463a0d270a1f717fd4939531d to your computer and use it in GitHub Desktop.
WP Job Manager Field Editor 1.8.6+ text-field.php template update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$key_class = "text-" . esc_attr( $key ); | |
$classes = array( 'jmfe-text-field', 'jmfe-input-text', 'input-text' ); | |
$classes[] = $key_class; | |
$maybe_required = ! empty( $field['required'] ) && get_option( 'jmfe_fields_html5_required', TRUE ) ? 'required' : ''; | |
$value = job_manager_field_editor_get_template_value( $args ); | |
$placeholder = array_key_exists( 'placeholder', $field ) ? esc_attr( $field['placeholder'] ) : ''; | |
$text_field_attributes = apply_filters( 'field_editor_text_field_attributes', '', $key, $field, $value ); | |
?> | |
<input type="text" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" name="<?php echo esc_attr( isset( $field['name'] ) ? $field['name'] : $key ); ?>" id="<?php echo esc_attr( $key ); ?>" title="<?php echo isset($field['title']) ? esc_attr( $field['title'] ) : ''; ?>" <?php echo ! empty($field['pattern']) ? "pattern=\"" . esc_attr($field['pattern']) . "\"" : ''; ?> placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr( $value ); ?>" <?php echo ! empty( $field['maxlength'] ) ? "maxlength=\"" . esc_attr( $field['maxlength'] ) . "\"" : ''; ?> <?php echo $maybe_required; ?> <?php echo $text_field_attributes; ?>/> | |
<?php if ( ! empty( $field['description'] ) ) : ?><small class="description <?php echo $key_class; ?>-description"><?php echo $field['description']; ?></small><?php endif; ?> |
Here's example of using the filter this adds:
https://gist.github.com/tripflex/fbdf624084c08b4df5d51a7aa0c3c59e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If using an older version 1.8.5 or older, update the file located at
wp-content/plugins/wp-job-manager-field-editor/templates/form-fields/text-field.php
with the contents of this gist