Jake Vanderwerf
2026-07-09 c68aefb847b09daa0697de7684d3451e2e68ce1e
inc/registrar/config/seo/Schema.php
@@ -93,49 +93,8 @@
      add_action('wp_head', [$this, 'outputSchema'], 1);
      add_filter('the_seo_framework_schema_graph_data', [$this, 'filterTSFSchema'], 10, 2);
      add_filter('the_seo_framework_title_from_custom_field', [$this, 'filterTSFOGTitle'], 10, 2);
      $this->maybeExcludeSingles();
   }
      protected function maybeExcludeSingles(): void
      {
         $exclude = $this->cache->remember(
            'excludeSingles',
            function () {
               $exclude = [];
               $registrar = Registrar::getInstance($this->slug);
               if ($registrar && $registrar->hasFeature('hide_single')) {
                  $exclude = $this->excludeSingle();
               }
               if ($registrar && $registrar->hasFeature('is_timeline')) {
                  $exclude = array_merge($exclude, $this->excludeTimeline());
               }
               return $exclude;
            }
         );
         if (!empty($exclude)) {
            add_filter('the_seo_framework_sitemap_exclude_ids', $exclude);
         }
      }
      protected function excludeSingle():array
      {
         return get_posts([
            'post_type'    => jvbCheckBase($this->slug),
            'posts_per_page'=> -1,
            'fields'    => 'ids',
            'post_status'  => 'publish',
         ]);
      }
      protected function excludeTimeline():array
      {
         return get_posts([
            'post_type'    => jvbCheckBase($this->slug),
            'posts_per_page'=> -1,
            'fields'    => 'ids',
            'post_status'  => 'publish',
            'post_parent__not_in'   => [0], // Only get posts with a parent
         ]);
      }
   public function filterTSFSchema(array $graph, ?array $args):array
   {
      $based = jvbCheckBase($this->slug);
@@ -184,7 +143,10 @@
               $config = $this->getConfig();
               $class = JVB()->schemaHelper()::classFromConfig($config, $meta);
               $class->setAuthor(JVB()->seo()->getCreator(true));
               if (property_exists($class, 'author')) {
                  $class->setAuthor(JVB()->seo()->getCreator(true));
               }
               $class = apply_filters('jvb_single_'.$this->slug.'_schema_output', $class, $ID);
               return $class->outputSchema();
@@ -246,11 +208,16 @@
         if (JVB_TESTING){
            $this->archiveCache->flush();
         }
         $this->archiveCache->flush();
         return $this->archiveCache->remember(
            $this->slug,
            function() {
               $action = BASE.ucfirst($this->slug).'Archive';
               $override = apply_filters($action.'Override', []);
               if (!empty($override)) {
                  return $override;
               }
               $config = JVB()->schemaHelper()->archive($this->slug);
               if (!array_key_exists('type', $config)) {
                  $config['type'] = 'JVBase\inc\managers\SEO\render\Thing\CreativeWork\WebPage\CollectionPage\CollectionPage';
@@ -487,9 +454,11 @@
            'type'   => 'JVBase\inc\managers\SEO\render\Thing\CreativeWork\Comment\Answer',
            'text'   => wp_strip_all_tags(str_replace("\n", '', $meta->get('post_content'))),
         ],
         'answerCount'  => 1,
      ];
      $question = SchemaHelper::classFromConfig($question);
      $page->setMainEntity($question);
      $page->setAuthor(JVB()->seo()->getCreator(true));
      return $page->outputSchema();