Last active
February 8, 2017 10:58
-
-
Save anthonybudd/0fb64c2d7d799ce4b604275b30c71942 to your computer and use it in GitHub Desktop.
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 | |
| 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