Last active
October 23, 2017 16:08
-
-
Save withinboredom/333d68b85f1295f8d93016a3bc37783b to your computer and use it in GitHub Desktop.
Using WordPress#
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
using WordPress.Includes; | |
namespace Example { | |
class ExampleClass { | |
public ExampleClass( WpHookManager hooks ) { | |
hooks.AddAction( "example", Callback, priority: 10, acceptedArgs: 0 ); | |
} | |
private async Task<object> Callback(IEnumerable<object> args) { | |
return true; | |
} | |
} | |
class Program() { | |
public int Main() { | |
var hooks = new WpHookManager(); | |
new ExampleClass( hooks ); | |
hooks.DoAction( "example" ); /* this is async, don't forget to `await` in real life!! */ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment