Mình sẽ hướng dẫn các bạn cách làm.
phương thức làm việc như sau: đầu tiên là đếm ký tự bài viết. nếu bài viết vượt số ký tự ta quy định sẽ tự động thêm <!–nextpage–>.
đầu tiên bạn mở wp-includes/query.php tìm:
thay đoạn đó thành:
Mình sẽ hướng dẫn các bạn cách làm.
1
2
|
$pages = array( $post->post_content );
$multipage = 0;
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
$max_lex = 5000; // Tổng ký tự 1 trang
$string = $content;
$strrpos = mb_strrpos($content," ");
$current = 0;
$pagesPost = ceil($strrpos/$max_lex);
$pagePost = 1;
if ($strrpos > $max_lex) {
$content = '';
while ($current < $strrpos) {
$stringtt = mb_substr($string, $current, $max_lex);
$numStr = mb_strrpos($stringtt," ");
if($pagePost<$pagesPost) $content .= $stringtt."<!--nextpage-->"; else $content .= $stringtt;
$current = $numStr + $current;
$pagePost++;
}
} else {
$content = $string;
}
if ( $page > 1 ) $more = 1;
$multipage = 1;
$content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
$content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
$content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
$pages = explode('<!--nextpage-->', $content);
$numpages = count($pages);
/* code by dinh quoc han & solitary */
|
Write admin description here..
Email idm - Email registration Serial IDM Key Internet Download Manager
11 Typography Theme WordPress miễn phí đẹp nhất
Dịch Vụ SEO Top Google Giá Rẻ tại hcm
Chương trình tự động Spam Comment Blog wordpress
Thêm Nofollow cho link menu wordpress
Tùy chỉnh trang chủ cho WordPress-Custom Page Template
Tùy chỉnh trang chủ cho WordPress - Custom Page Template
Tổng hợp các Ứng dụng Android hay nhất cho Galaxy Y
0 nhận xét: