if ( ! function_exists( 'separator_hookr' ) ) { add_filter( 'render_block_core/separator', 'separator_hookr', null, 2 ); /** * separator_hookr * * Method to add hooks using core/separator block * seperator block must have a trigger class name of wps-action-hook * followed by the desired hook name. * If hyphonating use underscores not dashes * Example class="wps-action-hook entry_content_hook" * * Works in conjunction with do_block_action() function. * * @param [type] $block_content * @param [type] $block * @return $block_content */ function separator_hookr( $block_content, $block ) { /* exit if no class set */ if ( ! isset( $block['attrs']['className'] ) ) { return $block_content; } /* Class is there, lets grab it */ $class = $block['attrs']['className']; /* If no trigger class ( wps-action-hook ) exit */ if (! str_contains( $class, 'wps-action-hook' )) { return $block_content; } /* we have our trigger class, so get the hook name, [1] */ $action = explode('wps-action-hook', $class)[1]; /* one more check, don't have to have it, but as long as the process is not to intensive lets roll with it */ if ( isset( $action ) && 'wps-action-hook ' . $action === $block['attrs']['className'] ) { $block_content = do_block_action( $action ); } return $block_content; } }