Created
April 13, 2014 20:36
-
-
Save Shelob9/10601262 to your computer and use it in GitHub Desktop.
Pods before/after form field(s) examples.
This file contains hidden or 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 | |
//Add a title/ description before the form. | |
add_action( 'pods_form_pre_fields', 'slug_form_header' ); | |
function slug_form_header() { | |
$header = '<h1>Title For Form</h1>'; | |
$header .= '<p>Description and/ or instructions for the form.</p>'; | |
echo $header; | |
} | |
//Add a header before a specific field. | |
add_action( 'pods_form_before_field', 'slug_color_header' ); | |
function slug_color_header( $field ) { | |
if ( $field === 'color' ) { | |
echo '<h3>Color For Shirt</h3>'; | |
} | |
} | |
//Add instructions after a specific field. | |
add_action( 'pods_form_after_field', 'slug_size_instruction' ); | |
function slug_size_instruction( $field ) { | |
if ( $field === 'size' ) { | |
echo '<em>Sizes run large.</em>'; | |
} | |
} | |
//add a captcha after all fields. | |
add_action( 'pods_form_after_fields', 'slug_form_captcha' ); | |
function slug_captcha() { | |
echo your_captcha_function(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment