首页 文章

Wordpress SEO插件(Yoast和SEO Framework)与Timber插件产生冲突

提问于
浏览
-2

我正在使用Timber插件和Underscores.me模板(https://github.com/timber/starter-theme)来创建一个网站 .

我使用了Yoast和SEO Framework插件,都创造了一个问题!当我在页面元中添加描述时,Timber不再起作用了 . 没有错误消息 . 但内容是空的 .

我有:WordPress 4.9.2木材版本1.6.0 SEO框架版本3.0.3

你知道为什么吗?

2 回答

  • 0

    我试图逐个卸载所有插件 . 显然,问题不是来自另一个插件 .

    我认为问题来自主题本身 .

    我还注意到模板“html-header.twig”包含 Headers 和描述的元字段 . 但是,当激活SEO插件时,这些元素仍保留在源代码中 . 什么创造了重复......

    此外,安装调试栏后,我没有看到任何错误 . 情况很奇怪 . 因为一旦在SEO插件中引入了页面描述,Twig查询就是空的......

    我不知道我的树枝查询中是否有错误 . 他们来了:

    Page digital.php

    <?php
    
    $context = Timber::get_context();
    
    $args = array(
        // Get post type project
        'post_type' => 'project',
        // Get all posts
        'posts_per_page' => -1,
        // Gest post by "digital" category
        'meta_query' => array(
            array(
                'key' => 'project_category',
                'value' => 'digital',
                'compare' => 'LIKE'
            )
        ),
        // Order by post date
        'orderby' => array(
            'date' => 'DESC'
        ),
    );
    
    $context['digitals'] = Timber::get_posts( $args );
    
    Timber::render( 'page-digital.twig', $context );
    

    Page digital.twig

    {% for post in digitals %}
                        {% if post.thumbnail %}
                            <a href="{{post.link}}" class="l-basicgrid-work work">
                                <article>
                                    <figure>
                                        <img data-src="{{post.get_thumbnail.src('medium_large')|resize(800, 533)}}" alt="{{post.title}}" class="lazy">
                                    </figure>
                                    <figcaption>
                                        <h2>{{ post.title }}</h2>
                                    </figcaption>
                                </article>
                            </a>
                        {% endif %}
                    {% endfor %}
    

    我做错什么了吗?

  • 0

    为什么你会在Yoast旁边运行另一个SEO插件? Yoast不能提供什么?

    我在我的所有网站上运行Yoast SEO和Timber而没有任何问题,我从未体验过它无法处理的任何事情 .

相关问题