Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Created February 11, 2017 17:06
Show Gist options
  • Select an option

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

Select an option

Save anthonybudd/d23f3ee75326ee3da3aaee7ea1685d4c to your computer and use it in GitHub Desktop.
<?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