Skip to content

Instantly share code, notes, and snippets.

@developez
Created February 26, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developez/9226700 to your computer and use it in GitHub Desktop.
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
<?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