我正在使用带有 Underscores.me 模板 ( https://github.com/timber/starter-theme ) 的 Timber 插件来创建网站。
我使用了 Yoast 和 SEO Framework 插件,都产生了问题!当我在页面的元数据中添加描述时,Timber 不再起作用。没有错误信息。但内容是空的。
我有: WordPress 4.9.2 Timber 版本 1.6.0 SEO 框架版本 3.0.3
你知道为什么吗?
我正在使用带有 Underscores.me 模板 ( https://github.com/timber/starter-theme ) 的 Timber 插件来创建网站。
我使用了 Yoast 和 SEO Framework 插件,都产生了问题!当我在页面的元数据中添加描述时,Timber 不再起作用。没有错误信息。但内容是空的。
我有: WordPress 4.9.2 Timber 版本 1.6.0 SEO 框架版本 3.0.3
你知道为什么吗?
你为什么要在 Yoast 旁边运行另一个 SEO 插件?它提供了什么是 Yoast 无法提供的?
我在我所有的网站上运行 Yoast SEO 和 Timber 都没有问题,而且我从来没有遇到过它无法处理的任何事情。
我试图一一卸载所有插件。显然,问题不是来自另一个插件。
我认为问题出在主题本身。
我还注意到模板“html-header.twig”包含标题和描述的元字段。但是,当激活 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 );
页面数字.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 %}
我做错什么了吗?