Created
February 11, 2017 17:06
-
-
Save anthonybudd/d23f3ee75326ee3da3aaee7ea1685d4c 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 Product extends WP_Model | |
| { | |
| public $postType = 'product'; | |
| public $attributes = [ | |
| 'color', | |
| 'weight', | |
| ]; | |
| public $deafult = [ | |
| 'color' => 'blue', | |
| ]; | |
| } | |
| $product1 = Product::insert([ | |
| 'color' => 'red' | |
| ]); | |
| $product2 = Product::insert([ | |
| 'weight' => '100' | |
| ]); | |
| echo $product1->color; // red | |
| echo $product2->color; // blue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment