Created
February 26, 2014 09:44
-
-
Save developez/9226700 to your computer and use it in GitHub Desktop.
Show the input interfaces of the fields of a pod without forms tags and submit button like forms method
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 | |
/* | |
Show the input interfaces of the fields of a pod without forms tags and submit button like forms method | |
*/ | |
function pods_utils_show_pod_fields($pod, $selected_fields = null, $pod_id = null, $name_prefix = "", $theme_name = ""){ | |
$pods = pods( $pod ); | |
$fields = $pods->fields(); | |
foreach($fields as $field) { | |
if($selected_fields != null) | |
if(!in_array($field['name'], $selected_fields)) | |
continue; | |
?> | |
<label for="<?php echo $name_prefix . $field['name']; ?>"> | |
<?php _e( $field['label'], $theme_name ); ?> | |
<?php $label['options']['required'] == 1 ? _e( '(required)', $theme_name ) : ""; ?> | |
</label> | |
<?php echo PodsForm::field( $name_prefix . $field['name'], null, $field['type'], $field, $pod_name, $pod_id ); ?> | |
<?php | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment