admin管理员组文章数量:1278983
I have a post type called families where I add personal information of each family, inside the data there is an option called status.
*IMPORTANT: The fields are created with ACF CUSTOM FIELDS
These families are shown on one page each. For example
What I need is to exclude the families that do not have the status Retained, and that are not shown or linked in the next and back buttons.
in my code I have functions get_next_post_link() and get_previous_post_link()
<?php
$older_link = get_next_post_link( '%link', '<i class="far fa-angle-right"></i>' );
$newer_link = get_previous_post_link( '%link', '<i class="far fa-angle-left"></i>' );
$previous = '<span class="meta-nav">Previous Post</span>';
$next = '<span class="meta-nav">Next Post</span>';
?>
<nav class="d-flex align-items-center navigation navigation-single">
<div class="arrows">
<?php echo $newer_link; ?>
<?php echo $older_link; ?>
</div>
</nav>
Thank you very much for your help
I have a post type called families where I add personal information of each family, inside the data there is an option called status.
*IMPORTANT: The fields are created with ACF CUSTOM FIELDS
These families are shown on one page each. For example
What I need is to exclude the families that do not have the status Retained, and that are not shown or linked in the next and back buttons.
in my code I have functions get_next_post_link() and get_previous_post_link()
<?php
$older_link = get_next_post_link( '%link', '<i class="far fa-angle-right"></i>' );
$newer_link = get_previous_post_link( '%link', '<i class="far fa-angle-left"></i>' );
$previous = '<span class="meta-nav">Previous Post</span>';
$next = '<span class="meta-nav">Next Post</span>';
?>
<nav class="d-flex align-items-center navigation navigation-single">
<div class="arrows">
<?php echo $newer_link; ?>
<?php echo $older_link; ?>
</div>
</nav>
Thank you very much for your help
Share Improve this question edited Oct 14, 2021 at 19:41 dexter asked Oct 14, 2021 at 16:40 dexterdexter 11 bronze badge1 Answer
Reset to default 1What is Status
? If it's a taxonomy - and, by the look of it, it should be - you can exclude any given term in get_previous_post_link using the $excluded_terms
parameter.
If status is not a taxonomy already, you might want to rethink that for performance reasons.
本文标签: phpHow exclude or skip post type with getnextpostlink
版权声明:本文标题:php - How exclude or skip post type with get_next_post_link 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741269985a2369101.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论