Skip to content

Instantly share code, notes, and snippets.

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 holisticnetworking/759b53307e61c4740389d6aa843d2cc0 to your computer and use it in GitHub Desktop.
Save holisticnetworking/759b53307e61c4740389d6aa843d2cc0 to your computer and use it in GitHub Desktop.
WP-Scholar Person CPT with EasyInputs
public static function name($post)
{
$ei = new EasyInputs([
'name' => 'Person',
'group' => 'name',
'type' => 'meta'
]);
// Use nonce for verification
wp_nonce_field(plugin_basename(__FILE__), 'scholar_name_nonce');
$prefix = get_post_meta($post->ID, 'scholar_prefix', true);
$first = get_post_meta($post->ID, 'scholar_first_name', true);
$middle = get_post_meta($post->ID, 'scholar_middle_name', true);
$last = get_post_meta($post->ID, 'scholar_last_name', true);
$gender = get_post_meta($post->ID, 'scholar_gender', true);
$suffix = get_post_meta($post->ID, 'scholar_suffix', true);
echo sprintf(
'<div class="scholar_row">
<div class="scholar_column large-4">%1$s</div>
<div class="scholar_column large-4">%2$s</div>
<div class="scholar_column large-4">%3$s</div>
</div>
<div class="scholar_row">
<div class="scholar_column large-4">%4$s</div>
<div class="scholar_column large-4">%5$s</div>
<div class="scholar_column large-4">%6$s</div>
</div>',
$ei->Form->input(
'prefix',
['label' => __('Prefix'), 'value' => $prefix]
),
$ei->Form->input(
'first',
['label' => __('First'), 'value' => $first]
),
$ei->Form->input(
'middle',
['label' => __('Middle'), 'value' => $middle]
),
$ei->Form->input(
'last',
['label' => __('Last'), 'value' => $last]
),
$ei->Form->input(
'suffix',
['label' => __('Suffix'), 'value' => $suffix]
),
$ei->Form->input(
'gender',
['label' => __('Gender'), 'value' => $gender]
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment