Skip to content

Instantly share code, notes, and snippets.

@collegeman
Created December 2, 2016 19:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
<?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