Created
February 6, 2017 16:54
-
-
Save anthonybudd/cee9c377d9b48a01ea325b1ef751cea9 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 | |
| Product::single(); // Returns the current model if on a single page or in the loop | |
| Product::exists(15); // Returns (bool) true or false | |
| $product->post() // Returns WP_Post object | |
| $product->permalink() // Returns post permalink | |
| $product->featuredImage($defaultURL) // Returns featured image URL | |
| $product->toArray() // Returns an array representation of the model | |
| Product::asList() // Returns array of posts keyed by the post's ID | |
| [ | |
| 15 => Product, | |
| 16 => Product, | |
| 17 => Product | |
| ] | |
| // You can also specify the value of each element in the array to be meta from the model. | |
| Product::asList('post_title') | |
| [ | |
| 15 => "Product 1", | |
| 16 => "Product 2", | |
| 17 => "Product 3" | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment