zoukankan      html  css  js  c++  java
  • wordpress上下篇

    分页一:

    <!--上下篇开始-->
    <div class="shangxia">
    <?php
      $current_category=get_the_category();
      $prev_post = get_previous_post($current_category,'');
      $next_post = get_next_post($current_category,'');
    ?>
    <?php if (!empty( $prev_post )): ?>
      <a href="<?php echo get_permalink( $prev_post->ID ); ?>" title="上一篇:<?php echo $prev_post->post_title; ?>">上一篇:<?php echo $prev_post->post_title; ?></a>
    <?php else : ?>
      <a title="已经是第一篇了">已经是第一篇了</a>
    <?php endif; ?>
    <!--上下片分离-->
    <?php if (!empty( $next_post )): ?>
      <a href="<?php echo get_permalink( $next_post->ID ); ?>" title="下一篇:<?php echo $next_post->post_title; ?>">下一篇:<?php echo $next_post->post_title; ?></a>
    <?php else : ?>
      <a title="已经是最后一篇了">已经是最后一篇了</a>
    <?php endif; ?>
    </div>
    <!--上下篇结束-->

    分页二:

    <?php
    $categories = get_the_category();
    $categoryIDS = array();
    foreach ($categories as $category) {
    array_push($categoryIDS, $category->term_id);
    }
    $categoryIDS = implode(",", $categoryIDS);
    ?>                
    <div class="post-blockE">
        <div class="post-previous">
            <?php if (get_previous_post($categoryIDS)) { previous_post_link('<span>上一篇:</span> %link');} else {echo "没有了,已经是最后文章";} ?>
        </div>
        <div class="post-next">
            <?php if (get_next_post($categoryIDS)) { next_post_link('<span>下一篇:</span> %link');} else {echo "没有了,已经是最新文章";} ?>
        </div>
    </div>    
  • 相关阅读:
    docker 入门(docker 镜像 、容器、仓库)
    windows 安装 docker
    关于go mod 的使用和goland 配置 go mod
    mac 安装docker
    vm 将宿主机文件夹 映射至 虚拟机
    centos 关于yum无法使用
    mac 安装 swoole 可能会出现的错误
    BZOJ3378:[USACO]MooFest 狂欢节(树状数组)
    BZOJ3110:[ZJOI2013]K大数查询(整体二分)
    BZOJ4170:极光(CDQ分治)
  • 原文地址:https://www.cnblogs.com/huige728/p/8037067.html
Copyright © 2011-2022 走看看