| | |
| | | |
| | | jvb_register_do_once('buildDirectories', [$this, 'activate']); |
| | | add_action('init', [$this, 'registerDirectories']); |
| | | add_filter('render_block', [$this, 'renderBlock'], 998, 3); |
| | | add_filter('pre_render_block', [$this, 'renderBlock'], 20, 3); |
| | | } |
| | | |
| | | public function registerDirectories():void |
| | |
| | | return $out; |
| | | } |
| | | |
| | | public function renderBlock(string $content, array $block, WP_Block $instance) |
| | | public function renderBlock(?string $content, array $block, ?WP_Block $instance) |
| | | { |
| | | if (!is_post_type_archive(BASE.'directory') && !is_singular(BASE.'directory')) { |
| | | return $content; |
| | |
| | | return $content; |
| | | } |
| | | |
| | | error_log('Still working on directory manager...'); |
| | | // For archive page |
| | | if (is_post_type_archive(BASE.'directory') && $block['blockName'] === 'core/group') { |
| | | return ($block['attrs']['tagName']??'' === 'main') ? '<main>'.$this->renderArchive().'</main>' : $content; |