Created
April 30, 2017 21:51
-
-
Save holisticnetworking/759b53307e61c4740389d6aa843d2cc0 to your computer and use it in GitHub Desktop.
WP-Scholar Person CPT with EasyInputs
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
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