Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WordPress通过分页在普通post循环之间显示自定义post类型的post_Php_Wordpress - Fatal编程技术网

Php WordPress通过分页在普通post循环之间显示自定义post类型的post

Php WordPress通过分页在普通post循环之间显示自定义post类型的post,php,wordpress,Php,Wordpress,我正在开发一个WordPress网站,我想根据以下逻辑显示帖子: 在首页上,我想显示10篇文章,然后分页,但在中每3篇文章我想显示另一篇自定义文章类型的文章 while ( have_posts() ) { the_post(); the_title(); the_content(); echo '<hr/>'; // Above will be shown 3 posts, // then my custom post type po

我正在开发一个WordPress网站,我想根据以下逻辑显示帖子:

在首页上,我想显示10篇文章,然后分页,但在中每3篇文章我想显示另一篇自定义文章类型的文章

while ( have_posts() ) {
    the_post();
    the_title();
    the_content();
    echo '<hr/>';

   // Above will be shown 3 posts, 
   // then my custom post type post ( pro_event, special)
   // After that remaining 7 Posts

}
pagination();
while(have_posts()){
_post();
_title();
_内容();
回声“
”; //上面将显示3个职位, //然后我的自定义帖子类型帖子(pro_事件,特殊) //之后,剩下的7个员额 } 分页();
我该怎么做

我应该在while循环()之间调用自定义posts类型posts代码,还是有其他方法


谢谢。

您可以通过简单的
语句来实现这一点,如果
语句:

$show\u post\u count=0;
while(have_posts()){
如果($show\u post\u count!=3){
_post();
_title();
_内容();
}否则{
//你的定制邮件在这里
}
回声“
”; $show_post_count++; } 分页();
希望这对你有帮助