Skip to content

Commit

Permalink
Merge pull request #384 from Automattic/fix/filters-not-firing
Browse files Browse the repository at this point in the history
Apply filter `liveblog_active_commands` later on so that hooking works
  • Loading branch information
sboisvert authored May 11, 2018
2 parents 7276863 + 2fc4130 commit b977325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ New iPad announced, launching next week — more info to come. /key
You can add new commands easily with a filter, the most basic command will add a class to entry, so you could do a simple `/highlight` which would add `type-highlight` to the entry container, letting you style the background color:

``` php
add_filter( 'liveblog_active_commands', array( __CLASS__, 'add_highlight_command' ), 10 );
add_filter( 'liveblog_active_commands', 'add_highlight_command', 10 );


public static function add_highlight_command( $commands ) {
function add_highlight_command( $commands ) {
$commands[] = highlight;
return $commands;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function load() {

// Allow plugins, themes, etc. to change
// the current command set.
$this->commands = apply_filters( 'liveblog_active_commands', $this->commands );
add_action( 'after_setup_theme', array( $this, 'custom_commands' ), 10 );

// This is the regex used to revert the
// generated author html back to the
Expand Down Expand Up @@ -84,6 +84,13 @@ public function load() {
add_action( 'liveblog_insert_entry', array( $this, 'do_action_per_type' ), 10, 2 );
}

/**
* Returns the custom commands and allows for customizing the command set
*
*/
public function custom_commands() {
$this->commands = apply_filters( 'liveblog_active_commands', $this->commands );
}
/**
* Gets the autocomplete config.
*
Expand Down

0 comments on commit b977325

Please sign in to comment.