网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 wordpress文章分页方法总结
内容
    编辑文章的时候,切换到html输入,然后在需要分页的地方输入
    代码如下:
    <!--nextpage-->
    有的主题仅仅添加了标签还不行,还需要主题能支持分页功能,如果你添加了分页标签,但主题没有分页的话,那你的主题就不支持分页功能,需要自己添加。
    添加方法:打开文章 模板(一般是主题的single.php)文件,如果不是single.php文件的话,需要自己去找到文章模板。。
    找到下面的函数
    代码如下:
    <?php the_content(); ?>
    然后在它的后面添加代码
    代码如下:
    <?php
    wp_link_pages( array( 'before' => '<div>' . __( '页码' ), 'after' => '</div>' ) );
    ?>
    虽然实现了分页功能但是不是很方便,因为分页标签的代码每次都需要手动输入
    过程:1、找到wp-includes/js/quicktags.js ,在其中找到下面这个javascript代码:
    代码如下:
    edButtons[edButtons.length]=new edButton(“ed_more”,”more”,”<!–more–>”,”",”t”,-1);
    在这个代码的后面加上如下代码:
    代码如下:
    edButtons[edButtons.length]=new edButton(“ed_next”,”page”,”<!–nextpage–>”,”",”p”,-1);
    2. 继续在wp-includes/js/quicktags.js 中找到如下代码:
    代码如下:
    j.Buttons[j.Buttons.length]=new edButton(a+”_more”,”more”,”<!–more–>”,”",”t”,-1);
    在后面加上如下代码:
    代码如下:
    j.Buttons[j.Buttons.length]=new edButton(a+”_next”,”page”,”<!–nextpage–>”,”",”p”,-1);
    OK ,此文件可以保存了。
    3. 找到wp-includes/js/quicktags.dev.js ,找到下面代码
    代码如下:
    /*
    edButtons[edButtons.length] =
    new edButton(‘ed_next’
    ,’page’
    ,’<!–nextpage–>’
    ,”
    ,’p’
    ,-1
    );
    */
    去掉注释,最后是下面的样子
    代码如下:
    edButtons[edButtons.length] =
    new edButton(‘ed_next’
    ,’page’
    ,’<!–nextpage–>’
    ,”
    ,’p’
    ,-1
    );
    4. 找到wp-admin/includes/post.php ,找到下面代码:
    代码如下:
    ‘link’, ‘unlink’, ‘wp_more’,
    在其后面添加代码:
    代码如下:
    ‘wp_page’,
    OK,当你打开编辑器写文章的时候,可视化状态下就会出现分页符的按钮,在你想插入页码的时候点击此按钮就行了
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/17 22:48:46