Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A useless but illustrative example of what an Illuminated WordPress Plugin looks like
<?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