Created
July 30, 2019 14:30
-
-
Save kylephillips/236d0a90aa2ea6fb628c5c1e4010f7be to your computer and use it in GitHub Desktop.
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
add_filter('nestedpages_quickedit_custom_fields', addCustomPageFieldsLeft, 10, 3); | |
function addCustomPageFieldsLeft($fields, $post_type, $column) | |
{ | |
if ( $column !== 'left' ) return $fields; // fields may be added to the left and right column | |
if ( $post_type->name !== 'post-type-name' ) return $fields; // add fields based on post type | |
$fields = [ | |
[ | |
'key' => 'field_name', // The meta key name | |
'label' => __('Custom Field', 'wp-nested-pages'), // The label for the field | |
'type' => 'date', // date|text|select | |
'format_save' => 'm/d/Y', // Required for date (PHP) | |
'format_datepicker' => 'mm/dd/yy', // JS Datepicker format | |
'required' => false, // Validates true|false | |
'validation_message' => __('A value is required.', 'wp-nested-pages'), // Displays if validation fails | |
'choices' => [] // Array of choices for select fields | |
] | |
]; | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment