Php Wordpress-显示博客文章和自定义文章之间的关系
我通过ACF创建了博客帖子和自定义帖子类型之间的关系,其中包含员工档案。通过这种关系,我能够显示到该员工个人资料的链接,该员工是一篇文章的作者 我现在想显示员工在其个人资料中创建的帖子列表。我找到了一个能做到这一点的。不幸的是,每当我给一个员工分配超过5篇博客文章时,下一篇就看不见了。你能帮我调整代码,在新行中显示超过5篇文章吗Php Wordpress-显示博客文章和自定义文章之间的关系,php,wordpress,advanced-custom-fields,custom-wordpress-pages,acfpro,Php,Wordpress,Advanced Custom Fields,Custom Wordpress Pages,Acfpro,我通过ACF创建了博客帖子和自定义帖子类型之间的关系,其中包含员工档案。通过这种关系,我能够显示到该员工个人资料的链接,该员工是一篇文章的作者 我现在想显示员工在其个人资料中创建的帖子列表。我找到了一个能做到这一点的。不幸的是,每当我给一个员工分配超过5篇博客文章时,下一篇就看不见了。你能帮我调整代码,在新行中显示超过5篇文章吗 <div class="author-content"> <?php /*
<div class="author-content">
<?php
/*
* Query posts for a relationship value.
* This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array)
*/
$documents = get_posts(array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'our_people_author', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
?>
<?php if( $documents ): ?>
<ul class="table-author">
<?php foreach( $documents as $document ): ?>
<li class="singleauth-list">
<a href="<?php echo get_permalink( $document->ID ); ?>"><img src="<?php echo get_the_post_thumbnail_url($document->ID, 'thumbnail');?>" class="people-post-image"></a>
<a href="<?php echo get_permalink( $document->ID ); ?>" class="author-links">
<?php echo get_the_title( $document->ID ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
-