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 | |
add_filter('piklist_validation_rules', 'check_valid_number', 11); | |
function check_valid_number($validation_rules) | |
{ | |
$validation_rules['my_number'] = array( | |
'rule' => "/[-+]?[0-9]*[.,]?[0-9]+/" | |
,'message' => __('is not a number') | |
); |
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 | |
// Create a validation rule called "my_file_exists" | |
add_filter('piklist_validation_rules', 'check_file_exists', 11); | |
function check_file_exists($validation_rules) | |
{ | |
$validation_rules['my_file_exists'] = array( | |
'callback' => 'my_validate_file_exists' |
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 | |
// create a sanitization rule called "my_email_sanitization" | |
add_filter('piklist_sanitization_rules', 'sanitize_email_function', 11); | |
function sanitize_email_function($sanitization_rules) | |
{ | |
$sanitization_rules['my_email_sanitization'] = array( | |
'callback' => 'sanitize_email_callback' |
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 | |
/* | |
Title: Add More Fields | |
Capability: manage_options | |
Order: 110 | |
Collapse: false | |
User ID: 1 | |
*/ |
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 | |
//Allow the comment block to read your custom "User ID" attribute. | |
add_filter('piklist_get_file_data', 'allow_user_id', 10, 2); | |
function allow_user_id($data, $type) | |
{ | |
// If not a User section than bail | |
if($type != 'users') |
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 | |
// Set the Post Title to "Order #" plus post ID: | |
function set_post_title_to_order_number($data, $post_array) | |
{ | |
if ($post_array['post_type'] == 'MY-POST-TYPE') | |
{ | |
return 'Order #' . $post_array['ID']; | |
} |
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 | |
add_filter('piklist_assets', 'my_assets'); | |
function my_assets($assets) | |
{ | |
array_push($assets['scripts'], array( | |
'handle' => 'my-javascript' | |
,'src' => 'http://mysite.com/js/my-javascript.js' |
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 | |
piklist('field', array( | |
'type' => 'email', | |
'field' => 'my_html5_email', | |
'label' => 'Enter your email address', | |
'attributes' => array( // Pass HTML5 attributes in the attributes array | |
'required' => 'required', | |
'placeholder' => 'Enter email address' |
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 | |
piklist('field', array( | |
'type' => 'html', | |
,'label' => 'HTML Field', | |
,'value' => '<strong>This is some html</strong>' | |
)); | |
?> |
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 | |
piklist('field', array( | |
'type' => 'textarea', | |
'field' => 'my_textarea', | |
'label' => 'Text Area', | |
'attributes' => array( | |
'rows' => 10, | |
'cols' => 50, |