0
我从我的查询结果如下:
组结果由VAR从字符串
Techn1
- P1一些文字
Techn2
- 点P22一些文字
Tech3车队
- P1一些其他文本
Techn2
- P52一些文字
Techn2
- P62一些文字
我想组由Tech#的方式的结果,其结果将是
Techn1
- p1部分文字
Techn2
P22一些文字
P52一些文字
P62一些文字
点Tech3车队
- P1一些其他文本
这是所用的代码:
$vars = new WP_Query(array('category_name' => 'actualite'));
while ($vars->have_posts()) : $vars->the_post();
$child_posts = types_child_posts("contenu");
foreach ($child_posts as $child_post) :
if($child_post->fields['theme']=='A'):
$technique =$child_post->fields['f1'];
if (@$lastTechnique != $technique):
print "<strong>".$technique."</strong><br>";
endif;
echo "- ".$child_post->fields['f2']." Some text : ".$child_post->fields['f3']." (some text : ";the_title();echo ")<br>";
else:
echo "";
endif;
endforeach;
endwhile;
亲爱的埃文,THX的尝试。它会返回比预期更多的结果,因为很多结果行会在输出中被复制多次。代码中放置foreach的地方肯定有问题。 – user5526048
你能告诉我现在的输出吗?你使用第一个还是第二个例子? –
nm我看到这个问题..它是用'the_title()'。发布修正... –