1
我是php新手,所以我想獲得一些幫助。在Wordpress中循環投資組合Next/Previous Button
我的客戶希望下一個和上一個按鈕在單個頁面組合中循環。那麼這是我正在使用的代碼。
<?php
$prev_post = get_previous_post();
$next_post = get_next_post();
$prev_post_link = !empty($prev_post) ? get_permalink($prev_post->ID) : true;
$next_post_link = !empty($next_post) ? get_permalink($next_post->ID) : true;
if(!empty($prev_post) && empty($prev_post_thumb)) $prev_post_thumb = prev_next_post_format_icon($prev_post->ID);
if(!empty($next_post) && empty($next_post_thumb)) $next_post_thumb = prev_next_post_format_icon($next_post->ID);
?>
當我使用真,對於前&下一個鏈接,它出現在第一和最後一個組合,但超鏈接將顯示爲http://1,而不是下一個投資組合。由於提前
這是我的html代碼:
<div class="dfd-controls mobile-hide">
<?php if(!empty($prev_post_link)) : ?>
<a href="<?php echo esc_url($prev_post_link); ?>" class="page-inner-nav nav-prev">
<div class="dfd-controler prev">
<div style="margin-top:7px; color:#fff;">Previous</div>
<!-- <div class="thumb prev">
<?php echo $prev_post_thumb; ?>
</div> -->
</div>
<!--<div class="pagination-title">Previous Project</div> -->
</a>
<?php endif; ?>
<?php if(!empty($next_post_link)) : ?>
<a href="<?php echo esc_url($next_post_link); ?>" class="page-inner-nav nav-next">
<div class="dfd-controler next">
<div style="margin-top:7px; color:#fff;">Next</div>
<!-- <div class="thumb next">
<?php echo $next_post_thumb; ?>
</div>-->
</div>
<!--<div class="pagination-title">Next Project</div>-->
</a>
<?php endif; ?>
喜馬克,那麼如果我在第一篇文章中,我應該能夠去以前的帖子,即如果我在最後一篇文章,也是最後一篇文章,我應該得到下一篇文章,即第一篇文章。它應該像一個循環。應該爲此做些什麼? – Zain
我修改了我的答案 - 使用第二組代碼 – Mark