最新活动:电脑PC端+手机端+微网站+自适应网页多模板选择-建站388元起价!!!
要源码
当前位置:主页 > 网站建设 > wordpress文章分页,搭建网站

wordpress文章分页,搭建网站

时间:2023-07-23 12:07:23 阅读: 文章分类: 网站建设 作者: IT网站员

导读:搭建网站搭建网站之前大叔介绍过很多wordpress 的分类列表分页和评论的分页,一直没介绍过文章内容的分页,今天有空写个教程来给大家学习一下,首先,wordpress文章分页自助建站技术建站技术论坛。

自助建站技术建站技术论坛

之前模板下载吧介绍过很多wordpress的分类列表分页和评论的分页,一直没介绍过文章内容的分页,今天有空写个教程来给大家学习一下,首先,wordpress文章分页要从编辑器和分页定义函数两个地方来实现,现在我们就直接走教程吧。

wordpress文章分页

首先,将下面的代码放入wordpress主题文件夹的functions.php内

  • // 在 WordPress 编辑器添加“下一页”按钮
  • add_filter('mce_buttons','add_next_page_button');
  • function add_next_page_button($mce_buttons) {
  •     $pos = array_search('wp_more',$mce_buttons,true);
  •     if ($pos !== false) {
  •         $tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
  •         $tmp_buttons[] = 'wp_page';
  •         $mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
  •     }
  •     return $mce_buttons;
  • }
  • //内容分页
  • function custom_wp_link_pages( $args = '' ) {
  •     $defaults = array(
  •         'before' => '<div class="pagelist">分页阅读:',
  •         'after' => '</div>',
  •         'text_before' => '',
  •         'text_after' => '',
  •         'next_or_number' => 'number',
  •         'nextpagelink' =>'下一页',
  •         'previouspagelink' =>'上一页',
  •         'pagelink' => '%',
  •         'echo' => 1
  •     );
  •     $r = wp_parse_args( $args, $defaults );
  •  dede手机模板   $r = apply_filters( 'wp_link_pages_args', $r );
  •     extract( $r, EXTR_SKIP );
  •     global $page, $numpages, $multipage, $more, $pagenow;
  •     $output = '';
  •     if ( $multipage ) {
  •         if ( 'number' == $next_or_number ) {
  •             $output .= $before;
  •             for ( $i = 1; $i < ( $numpages + 1 ); $i = $i + 1 ) {

    关键词标签: WordPress 文章 分页

  • 声明: 本文由我的SEOUC技术文章主页发布于:2023-07-23 ,文章wordpress文章分页,搭建网站主要讲述分页,文章,wordpress网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_35447.html

    我的IDC 网站建设技术SEOUC.COM
    专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
  • 5000+合作客服
  • 8年从业经验
  • 150+覆盖行业
  • 最新热门源码技术文章