Skip to content

Commit

Permalink
Add author_name virtual field. #35
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Jul 12, 2021
1 parent 3c65862 commit e4bf39b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/oik-fields-virtual-author.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

function bw_fields_get_author_name( $parms ) {
//print_r( $parms);
//gob();
$author_name = get_the_author();
return $author_name;
}
12 changes: 12 additions & 0 deletions oik-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,18 @@ function oik_fields_oik_fields_loaded() {
, "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 );


}
Expand Down

0 comments on commit e4bf39b

Please sign in to comment.