Description
Implement "oik_fields_loaded" action for oik-fieldsHere we register the virtual fields that may be used directly in the bw_fields shortcode or can be registered as a virtual field of a post type For example the "_file_size" virtual field could be applied to an attachment such as a PDF The "featured" image is the full size image The "thumbnail" is the thumbnail sized version of the featured image
Usage
oik_fields_oik_fields_loaded();Parameters
Returns
voidSource
File name: oik-fields/oik-fields.phpLines:
1 to 66 of 66
function oik_fields_oik_fields_loaded() { $field_args = array( "#callback" => "bw_fields_get_file_size" , "#parms" => "_wp_attached_file" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) ); bw_register_field( "file_size", "virtual", "File size", $field_args ); $field_args = array( "#callback" => "bw_fields_get_dimensions" , "#parms" => "_wp_attachment_metadata" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) ); bw_register_field( "dimensions", "virtual", "Dimensions", $field_args ); $field_args = array( "#callback" => "bw_fields_get_featured_image" , "#parms" => "_thumbnail_id" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) , "#label" => false ); bw_register_field( "featured", "virtual", "Featured image", $field_args ); $field_args[ "#callback" ] = "bw_fields_get_thumbnail"; bw_register_field( "thumbnail", "virtual", "Thumbnail", $field_args ); $field_args = array( "#callback" => "bw_fields_get_google_map" , "#parms" => "_post_code,_lat,_long" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual-google-map.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) ); bw_register_field( "googlemap", "virtual", "Google map", $field_args ); $field_args = array( "#callback" => "bw_fields_get_template" , "#parms" => "_wp_page_template" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) ); bw_register_field( "template", "virtual", "Page template", $field_args ); /** * Registers the Author name field, to display the name of the post's author. */ $field_args = array( "#callback" => "bw_fields_get_author_name" , "#parms" => "" , "#plugin" => "oik-fields" , "#file" => "includes/oik-fields-virtual-author.php" , "#form" => false , "hint" => __( "virtual field", "oik-fields" ) ); bw_register_field( "author_name", "virtual", "Author", $field_args ); }View on GitHub
