WordPress单篇文章分页,获取总页数代码

	<?php 
/YuanZiFan Add Code 加总页数
			$TheURLforthisPage=$_SERVER['REQUEST_URI'];
			$arrayForPageNum=explode('/', $TheURLforthisPage);
			$CurrentPageNum=end($arrayForPageNum); 
			$CurrentPageNum=$arrayForPageNum[3];
			$RedirectURL="/".$arrayForPageNum[1]."/".$arrayForPageNum[2]."/";//除了页面以外的地址
			if ($CurrentPageNum=='') {$CurrentPageNum=1;}
			$allcontentthispage=$post->post_content;
			$pagenavCode = 'nextpage';
			$total_Page_nums=substr_count($allcontentthispage,$pagenavCode);
			$total_Page_nums=$total_Page_nums+1; 
			//YuanZiFan Add Code 加总页数
			?>

主要是同构‘NextPage’来拆分页面。判断多少个nextPage,页码数就是多少。
通过URL中的地址段,获取URL中的页面信息,得知当前是第多少页。文章源自原紫番博客-https://www.yuanzifan.com/54463.html 文章源自原紫番博客-https://www.yuanzifan.com/54463.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
 
    • Josephwrarl 4

      非常有用的 旅游网站, 请继续 方向正确。谢谢您. [url=https://iqvel.com/zh-Hans/a/%E6%84%8F%E5%A4%A7%E5%88%A9/%E7%9A%AE%E7%A7%91%E6%B4%9B%E7%B1%B3%E5%B0%BC%E5%AE%AB]皮科洛米尼宮[/url] 万分感谢 美丽的地方描写。确确实实 吸引人。

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    拖动滑块以完成验证