WordPress的上一页/下一页链接
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WordPress的上一页/下一页链接相关的知识,希望对你有一定的参考价值。
<?php /* prev/next links */ if ($post->post_parent == 19) { /* 19 == id of 'Rooms' page */ $toplevel = 'title_li=&depth=1&echo=0&exclude='.$exclude; $siblings = $toplevel.'&child_of='.$post->post_parent; pause_exclude_pages(); $links = ($post->post_parent) ? wp_list_pages($siblings) : wp_list_pages($toplevel); resume_exclude_pages(); } else { $links = ($post->post_parent) ? wp_list_pages($siblings) : wp_list_pages($toplevel); } foreach($links as $k=>$v) { if (strpos($v,'current_page_item') !== FALSE) { $current = $k; } $links[$k] = $v.'</li>';} if ($current == $total) $next = '0'; // if you're on the last page, next will be the first if ($current == '0') $prev = $total; // if you're on the first page, prev will be the last function change_anchor_text($link, $newtext, $placement) { if($placement == 'before') { } else if ($placement == 'after') { } else if ($placement == 'replace') { } } $prevLinkb = $prevLink; $prevLink = change_anchor_text($prevLink, ' < View Previous Room ', 'replace'); /* link customization goes here */ $nextLink = change_anchor_text($nextLink, ' View Next Room > ', 'replace'); $prepend = ''; $separator = '<a href="/lodging/" class="norm">Return to All Rooms</a>'; $separator2 = '<a href="#" class="norm">Check Availability Online</a>'; echo '<p class="pnpn">'.$prepend.$prevLink.$separator.$nextLink.'</p>'; } /* end prev/next links */ ?>
以上是关于WordPress的上一页/下一页链接的主要内容,如果未能解决你的问题,请参考以下文章