Created
December 2, 2016 19:13
-
-
Save collegeman/0ea4f4263fec0e78e47a8b1b78d89195 to your computer and use it in GitHub Desktop.
A useless but illustrative example of what an Illuminated WordPress Plugin looks like
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 | |
namespace YourPlugin; | |
/** | |
* Your plugin inherits everything that a Laravel container can do. | |
* Like, querying a database, which is useless, but illustrative. | |
*/ | |
class YourPlugin extends \FatPanda\Illuminate\WordPress\Plugin | |
{ | |
/** | |
* This function is automatically discovered and hooked | |
* into WordPress' "init" event. | |
*/ | |
function onInit() | |
{ | |
// you wouldn't ever need to do this, but it's a helpful illustration: | |
$latestPosts = $this->db->table('posts')->orderBy('post_date', 'DESC'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment