Jake Vanderwerf
2026-05-31 d7e7d248cbe41cd7a9ef9c2fb022b6c4831f99a3
inc/managers/DirectoryManager.php
@@ -38,7 +38,7 @@
      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
@@ -85,6 +85,7 @@
   public function getDirectories():array
   {
      $directories = get_option(BASE.'directories');
      if (!$directories) {
         $directories = [];
         //content
@@ -134,7 +135,7 @@
         $title = $config['title'];
         //Bail early if we've already created the page
         $existing = new WP_Query([
            'post_type' => BASE.'dash',
            'post_type' => BASE.'directory',
            'name'   => sanitize_title($title),
            'posts_per_page'  => 1,
         ]);
@@ -228,7 +229,6 @@
//                ];
//            }
//        }
        if (!empty($created)) {
            update_option(BASE.'directory_ids', $created);
        }
@@ -240,6 +240,7 @@
   protected function buildDirectoryList():array
   {
      $saved = get_option(BASE.'directory_list', []);
      if (empty($saved)) {
         $all = new WP_Query([
            'post_type' => BASE.'directory',
@@ -697,7 +698,7 @@
        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;
@@ -706,7 +707,6 @@
            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;