WordPress <! - nextpage - >标签实际上如何工作?

时间:2009-11-09 19:12:27

标签: wordpress

会发生什么?

我猜测在显示之前以某种方式解析帖子或页面,然后分成两种方法?我似乎无法找到有关基础

的任何文档
<?php wp_link_pages( $args ); ?> 

方法确实有效。是在用户加载相关页面之前完成所有这些处理,还是将其扫描并分别存储在数据库中?

2 个答案:

答案 0 :(得分:2)

WordPress使用PHP explode函数将内容拆分为“页面”数组。使用以下代码在setup_postdata函数中发生:

$pages = explode('<!--nextpage-->', $content);

答案 1 :(得分:0)

来自http://www.digimantra.com/tutorials/wordpress/multipaging-a-single-post-using-wp_link_pages/

Wordpress有一个名为wp_link_pages()的模板标签,负责帖子的分页。所以你必须把它放在the_content()标签之后。与所有其他wordpress标签一样,这又有很少的参数可以帮助您以非常简单的方式自定义功能。以下是wordpress文档定义的参数。

before (string) Text to put before all the links. Defaults to <p>Pages:

after (string) Text to put after all the links. Defaults to </p>.

link_before (string) Text that goes before the text of the link.

link_after (string) Text that goes after the text of the link.

next_or_number (string) Indicates whether page numbers should be used. Valid values are:
* number (Default)
* next (Valid in WordPress 1.5 or after)

nextpagelink (string) Text for link to next page. Defaults to Next page.

previouspagelink (string) Text for link to previous page. Defaults to Previous page.

pagelink (string) Format string for page numbers.  % in the string will be replaced with the number, so Page % would generate “Page 1″, “Page 2″, etc. Defaults to %.

more_file (string) Page the links should point to. Defaults to the current page.