Created
December 2, 2016 19:13
Star
You must be signed in to star a gist
A useless but illustrative example of what an Illuminated WordPress Plugin looks like
This file contains 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