I’m writing my own plugin.
works like this:
function myfunc (){
$a = 'hello';
// the sentence what Am looking for:
if ( user is logged and is the author of current post / page ){
$a= 'author';
}
return $a;
}
Wondering how I can do that sencence / function?
Just compare display names:
The
get_the_author()
function returnsdisplayname
, which should be able to be compared against thedisplayname
parameter that is a part of the$currentuser
object.You can get this information using the current_user and post variables.