Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active February 8, 2017 10:58
Show Gist options
  • Select an option

  • Save anthonybudd/0fb64c2d7d799ce4b604275b30c71942 to your computer and use it in GitHub Desktop.

Select an option

Save anthonybudd/0fb64c2d7d799ce4b604275b30c71942 to your computer and use it in GitHub Desktop.
<?php
Class Post extends WP_Model
{
public $postType = 'post'; // Deault WordPress 'post' post type
public $attributes = [];
public $virtual = [
'author'
];
public function _getAuthor(){
return get_user_by('id', $this->_post->post_author);
}
}
$defaultPost = Post::find(1);
$email = $defaultPost->author->user_email;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment