Jake Vanderwerf
5 days ago 266aa37c48222993bf7bdad6834e31bd08736f5e
=Post type archive meta title fix
8 files modified
50 ■■■■ changed files
base/SchemaHelper.php 1 ●●●● patch | view | raw | blame | history
inc/blocks/CustomBlocks.php 22 ●●●● patch | view | raw | blame | history
inc/managers/SEO/BreadcrumbManager.php 3 ●●●● patch | view | raw | blame | history
inc/managers/SEO/render/SchemaOutput.php 6 ●●●● patch | view | raw | blame | history
inc/managers/SEO/render/Traits/ThingSchema.php 2 ●●● patch | view | raw | blame | history
inc/registrar/config/seo/Meta.php 2 ●●●●● patch | view | raw | blame | history
inc/registrar/config/seo/Resolver.php 7 ●●●●● patch | view | raw | blame | history
inc/registrar/config/seo/Schema.php 7 ●●●● patch | view | raw | blame | history
base/SchemaHelper.php
@@ -125,6 +125,7 @@
            default => [],
        };
        $result = apply_filters(BASE.ucfirst($type).ucfirst($format).'Default', $defaults);
        if ($format === 'reference' && empty($result)) {
            $full = self::getDefault($type, 'schema');
inc/blocks/CustomBlocks.php
@@ -102,7 +102,7 @@
        } else if (method_exists($this, $method)) {
            $content = $this->$method($block, $content, $parent);
            return $isPrerender ? $this->maybeOutputCustomStyles().$content : $content;
        } elseif (!empty($blockName) && JVB_TESTING) {
        } elseif (JVB_TESTING && !empty($blockName)) {
            if (!in_array($block['blockName'], $this->getIgnore($isPrerender))) {
                jvbDump('No method found for '.print_r($block['blockName'], true));
            }
@@ -231,7 +231,7 @@
    public function prerender_core_columns(array $block, ?string $content, ?WP_Block $parent):?string
    {
        jvbDump($block, 'columns');
//      jvbDump($block, 'columns');
        $attrs = $block['attrs']??[];
        $tagName = array_key_exists('tagName', $attrs) ? $attrs['tagName'] : 'section';
@@ -654,7 +654,7 @@
    public function prerender_core_paragraph(array $block, ?string $content, ?WP_Block $parent):?string
    {
        jvbDump($block, 'paragraph');
//      jvbDump($block, 'paragraph');
//      jvbDump($parent, 'Parent');
        $inside = $this->inside($block);
        return empty($inside) ? '' : sprintf(
@@ -1359,7 +1359,10 @@
        $inner = '';
        if (!static::$currentLoop) {
            if (JVB_TESTING) {
            jvbDump('No loop stored');
            }
            return $content;
        }
        if (static::$currentLoop->have_posts()) {
@@ -1799,7 +1802,7 @@
    public function prerender_core_query_title(array $block, ?string $content, ?WP_Block $parent):?string
    {
        jvbDump($block, 'query title');
//      jvbDump($block, 'query title');
        $attr = $block['attrs'];
        $name = '';
        $showPrefix = $attr['showPrefix']??false;
@@ -1952,7 +1955,7 @@
    //core_archives
    public function render_core_archives(array $block, string $content):string
    {
        jvbDump($block, 'archives');
//      jvbDump($block, 'archives');
        $attrs = $block['attrs']??[];
        $isDropdown = $this->checkAttrs('displayAsDropdown', $attrs);
@@ -2214,7 +2217,6 @@
        }
        $inside = [];
        foreach($pages->posts as $page) {
            jvbDump($page);
            $inside[] = sprintf(
                '<li><a href="%s">%s</a>',
                get_the_permalink($page->ID),
@@ -3209,8 +3211,11 @@
                            $styles['color'] = $this->getColor($v['text']);
                        }
                        if (isset($v['gradient'])) {
                            if (JVB_TESTING) {
                            jvbDump($v, 'Gradient');
                        }
                        }
                        break;
                    case 'layout':
@@ -3279,9 +3284,11 @@
                            if ($sk === 'minHeight') {
                                $styles['min-height'] = $sv;
                            } else {
                                if (JVB_TESTING) {
                                jvbDump('No config set for dimension '.$sk.': '.print_r($sv, true));
                            }
                        }
                        }
                        break;
@@ -3443,8 +3450,11 @@
                        }, $selectors);
                        $fullSelector = implode(',', $fullSelector);
                        if (JVB_TESTING) {
                        jvbDump($state, 'state');
                        jvbDump($rules, 'rules');
                        }
                        if (isset($rules['color']['text']) || isset($rules['text'])) {
                            $css['color'] = $this->getColor($rules['color']['text'] ?? $rules['text']);
inc/managers/SEO/BreadcrumbManager.php
@@ -224,7 +224,7 @@
        $registrar = Registrar::getInstance($name);
        if($registrar && $registrar->hasFeature('show_directory')) {
        if($registrar && $registrar->hasFeature('show_directory') && JVB()->directories()) {
            $directory = JVB()->directories();
            if ($directory && !empty($directory->directories($name)??[])){
                $crumbs[] = [
@@ -233,6 +233,7 @@
                ];
            }
        } elseif (Site::has('is_directory') && $name === 'directory') {
            $crumbs[] = [
                'name'  => JVB()->directories()->referAs(true),
                'url'   => get_post_type_archive_link($type)
inc/managers/SEO/render/SchemaOutput.php
@@ -39,7 +39,7 @@
                $schema[] = $seo->schema()->outputSingularSchema();
            }
        }elseif (is_post_type_archive($this->types)) {
            error_log('It is a post type archive');
            $type = get_queried_object();
            $type = $type->name;
            $registrar = Registrar::getInstance($type);
@@ -62,9 +62,9 @@
            return intval(get_option(BASE.$item.'_archive', false));
        },Registrar::getFeatured('is_content', 'term'))));
        if (is_page($isContent)){
        if (!empty($isContent) && is_page($isContent)){
            $type = get_post_meta(get_the_id(), BASE.'for_type', true);
            error_log('Type: '.print_r($type, true));
//          error_log('Type: '.print_r($type, true));
            if (!empty($type)) {
                $registrar = Registrar::getInstance($type);
                if ($registrar) {
inc/managers/SEO/render/Traits/ThingSchema.php
@@ -65,7 +65,7 @@
                    $value = $value->getTime();
                }else if (!is_string($value)) {
                    if (JVB_TESTING && !is_numeric($value)) {
                        error_log('Normal value? '.print_r($value, true));
//                      error_log('Normal value? '.print_r($value, true));
                    }
                }
inc/registrar/config/seo/Meta.php
@@ -55,11 +55,13 @@
    public function filterTitle(string $title, ?array $args): string
    {
        error_log('Filtering title...');
        if (jvbTSFDoIt($this->slug, $args)){
            return $title;
        }
        $ID = jvbTSFGetID($args);
        $meta = new \JVBase\meta\Meta($ID, Registrar::getInstance($this->slug)->getType());
        return Resolver::resolve($this->title, $meta);
    }
inc/registrar/config/seo/Resolver.php
@@ -36,6 +36,13 @@
        switch ($variable) {
            case 'CREATOR':
                return JVB()->seo()->getCreator();
            case 'name':
                if (is_post_type_archive()) {
                    $obj = get_queried_object();
                    $registrar = Registrar::getInstance($obj->name);
                    return $registrar ? $registrar->getPlural() : $obj->label;
                }
                break;
        }
        if (str_contains($variable, '.')) {
inc/registrar/config/seo/Schema.php
@@ -295,7 +295,10 @@
                    $class->setMainEntity($itemList);
                    $schema = $class->outputSchema();
                    error_log('Generated archive schema: '.print_r($schema, true));
                    if (JVB_TESTING) {
//                      error_log('Generated archive schema: '.print_r($schema, true));
                    }
                    return $schema;
                }
            );
@@ -440,7 +443,7 @@
            $title = Resolver::resolve($config['name']??$config['title']??'', $meta);
        } elseif (is_post_type_archive($based) ) {
            $config = $this->getConfig('archive');
            $title = $config['name'];
            $title = Resolver::resolve($config['name'], null);
        } elseif (is_tax($based)) {
            $config = $this->getConfig('archive');
            $meta = Meta::forTerm(get_queried_object_id());