Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion genesis-simple-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ public function execute_hooks() {
if ( isset( $array['unhook'] ) ) {

foreach( (array) $array['unhook'] as $function ) {
remove_action( $hook, $function );
$function = explode( ',', $function );
if ( !isset( $function[1] ) ) {
remove_action( $hook, $function[0] );
}
else {
remove_action( $hook, $function[0], $function[1] );
}
}

}
Expand Down
18 changes: 13 additions & 5 deletions includes/class-genesis-simple-hooks-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function define_hooks() {
),
'genesis_before_entry_content' => array(
'description' => __( 'Executes before the entry content', 'genesis-simple-hooks' ),
'unhook' => array( 'genesis_do_post_content' ),
'unhook' => array( array( 'genesis_do_post_image', 8 ), 'genesis_do_post_content' ),
),
'genesis_entry_content' => array(
'description' => __( 'Executes as part of the entry. Genesis uses this hook to output the entry content.', 'genesis-simple-hooks' ),
Expand All @@ -269,7 +269,7 @@ public function define_hooks() {
),
'genesis_after_entry' => array(
'description' => __( 'Executes after the entry.', 'genesis-simple-hooks' ),
'unhook' => array( 'genesis_adjacent_entry_nav', 'genesis_get_comments_template' ),
'unhook' => array( array( 'genesis_do_author_box_single', 8 ), 'genesis_adjacent_entry_nav', 'genesis_get_comments_template' ),
),
);

Expand All @@ -290,7 +290,7 @@ public function define_hooks() {
),
'genesis_post_title' => array(
'description' => __( 'Executes as part of the post. Genesis uses this hook to output the post title.', 'genesis-simple-hooks' ),
'unhook' => array( 'genesis_do_post_title' ),
'unhook' => array( 'genesis_do_post_title', array( 'genesis_post_info', 12 ) ),
),
'genesis_after_post_title' => array(
'description' => __( 'Executes after the post title.', 'genesis-simple-hooks' ),
Expand Down Expand Up @@ -488,13 +488,21 @@ public function generate_form_markup_from_hooks( $hooks ) {
if ( isset( $info['unhook'] ) ) {

foreach ( (array) $info['unhook'] as $function ) {
if ( is_array( $function ) ) {
$function_name = $function[0];
$function = implode( ',', $function );
}
else {
$function_name = $function;
}

printf(
'<label><input type="checkbox" name="%s" id="%s" value="%s" %s/> %s</label><br />',
$this->settings_field . "[{$hook}][unhook][]",
$this->settings_field . "[{$hook}][unhook][]",
$this->settings_field . "[{$hook}][unhook][" . $function_name . "]",
$function,
in_array( $function, (array) simplehooks_get_option( $hook, 'unhook' ) ) ? 'checked' : '',
sprintf( __( 'Unhook <code>%s()</code> function from this hook?', 'genesis-simple-hooks' ), $function )
sprintf( __( 'Unhook <code>%s()</code> function from this hook?', 'genesis-simple-hooks' ), $function_name )
);
}

Expand Down