English 中文(简体)
How does the WordPress <!--nextpage--> tag actually work?
原标题:
  • 时间:2009-11-09 19:12:26
  •  标签:
  • wordpress

What happens?

I m guessing that somehow the post or page is parsed before displaying, and then just split into two methods? I can t seem to find any documentation on how the underlying

<?php wp_link_pages( $args ); ?> 

method actually works. Is all of this processing done before the user loads the concerned page, or is it scanned and then stored separately inside the database?

最佳回答

WordPress uses the PHP explode function to split the content into a array of pages . Happens in the setup_postdata function with this code:

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

问题回答

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

Wordpress has a template tag called wp_link_pages() which is responsible for the pagination of the post. So you have to put this after the the_content() tag. As all other wordpress tags this again have few parameters which help you customize the function in very simple way. Here are the params as defined by the wordpress documentation.

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.




相关问题
Wrap stray text in <p> tags

Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = "content"> <img src = "hello.jpg"/> <h1>Introduction</h1> Hello! this is ...

Using jQuery Plugins with Wordpress

Having a bit of trouble using jQuery plugins (Superfish, jQuery UI, etc) using Wordpress. Everything works fine in my plain non-Wordpress site, but Wordpress seems to conflict with JQuery. There must ...

WordPress Data Storage Efficiency

I ve been asked to review a WordPress plugin of sorts and try to find ways of making it faster. The premise of this plugin is basically to store a bunch of users and shifts and appointments and ...

Why can t I properly style a blockquote in Wordpress?

On the design I just created for my website, I have a blockquote styled with two quote images using the span technique in css: blockquote { background-image: url(images/openquote.jpg); background-...

How does the WordPress <!--nextpage--> tag actually work?

What happens? I m guessing that somehow the post or page is parsed before displaying, and then just split into two methods? I can t seem to find any documentation on how the underlying <?php ...

Wordpress Plug-ins: How-to add custom URL Handles

I m trying to write a Wordpress Plug-in but can t seem to figure out how you would modify how a URL gets handled, so for example: any requests made for: <url>/?myplugin=<pageID> will ...

热门标签