the_post() 应在while 循环(或循环)。一、 e.在调用以下函数之前the_permalink() 和the_title() 指向循环中的当前项。
所以你的while 循环应该这样开始:(并移除另一个the_post(); 在您的代码中)
while ( have_posts() ) : the_post();
浏览器将您发送到
about:blank#blocked 很可能是因为
a 元素具有无效
href (URL)值:
https:// 例如:
<a href="https://">Example</a>
很可能是因为
get_field(\'website\') 返回空值;例如,由于post数据(ID/对象)错误。
所以这部分:
if (is_post_type_archive( $resources )) {
echo \'https://\' . get_field(\'website\');
}
可以重写为:
if (is_post_type_archive( $resources )) {
if ( $url = get_field(\'website\') ) {
echo \'https://\' . $url;
} else {
the_permalink();
}
}
但我假设
website 字段不以协议开头(例如。
https:// 或
http://).
没有必要回音the_permalink() 因为函数已经回显永久链接/URL。