怎么给wp博客文章分页加上nofollow标签? 20
if(!function_exists('deel_paging')):functiondeel_paging(){$p=4;if(is_singular())retur...
if ( ! function_exists( 'deel_paging' ) ) :
function deel_paging() {
$p = 4;
if ( is_singular() ) return;
global $wp_query, $paged;
$max_page = $wp_query->max_num_pages;
if ( $max_page == 1 ) return;
echo '<div class="pagination"><ul>';
if ( empty( $paged ) ) $paged = 1;
// echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> ';
echo '<li class="prev-page">'; previous_posts_link('上一页'); echo '</li>';
if ( $paged > $p + 1 ) p_link( 1, '<li>第一页</li>' );
if ( $paged > $p + 2 ) echo "<li><span>···</span></li>";
for( $i = $paged - $p; $i <= $paged + $p; $i++ ) {
if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "<li class=\"active\"><span>{$i}</span></li>" : p_link( $i );
}
if ( $paged < $max_page - $p - 1 ) echo "<li><span> ... </span></li>";
//if ( $paged < $max_page - $p ) p_link( $max_page, '»' );
echo '<li class="next-page">'; next_posts_link('下一页'); echo '</li>';
// echo '<li><span>共 '.$max_page.' 页</span></li>';
echo '</ul></div>';
}
function p_link( $i, $title = '' ) {
if ( $title == '' ) $title = "第 {$i} 页";
echo "<li><a href='", esc_html( get_pagenum_link( $i ) ), "' >{$i}</a></li>";
}
endif;
代码如上,怎么可以加上nofollow标签?这个是在function.php的文件里。
<li><a href='", esc_html( get_pagenum_link( $i ) ), "' >{$i}</a></li>
这里面直接放入rel=“nofollow”,网站就不能正常显示了。 展开
function deel_paging() {
$p = 4;
if ( is_singular() ) return;
global $wp_query, $paged;
$max_page = $wp_query->max_num_pages;
if ( $max_page == 1 ) return;
echo '<div class="pagination"><ul>';
if ( empty( $paged ) ) $paged = 1;
// echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> ';
echo '<li class="prev-page">'; previous_posts_link('上一页'); echo '</li>';
if ( $paged > $p + 1 ) p_link( 1, '<li>第一页</li>' );
if ( $paged > $p + 2 ) echo "<li><span>···</span></li>";
for( $i = $paged - $p; $i <= $paged + $p; $i++ ) {
if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "<li class=\"active\"><span>{$i}</span></li>" : p_link( $i );
}
if ( $paged < $max_page - $p - 1 ) echo "<li><span> ... </span></li>";
//if ( $paged < $max_page - $p ) p_link( $max_page, '»' );
echo '<li class="next-page">'; next_posts_link('下一页'); echo '</li>';
// echo '<li><span>共 '.$max_page.' 页</span></li>';
echo '</ul></div>';
}
function p_link( $i, $title = '' ) {
if ( $title == '' ) $title = "第 {$i} 页";
echo "<li><a href='", esc_html( get_pagenum_link( $i ) ), "' >{$i}</a></li>";
}
endif;
代码如上,怎么可以加上nofollow标签?这个是在function.php的文件里。
<li><a href='", esc_html( get_pagenum_link( $i ) ), "' >{$i}</a></li>
这里面直接放入rel=“nofollow”,网站就不能正常显示了。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询