<?php $callout = array(
'1',
'3',
'5'
); ?>
<ul>
<?php foreach($callout as $call) { ?>
<li>
<h3><?php echo get_the_title($call); ?></h3>
<p>different text goes here...</p>
</li>
<?php } ?>
</ul>
是否有可能 - 如果$ call = 1则回显一些静态文本,如果2回显别的东西,依此类推?
答案 0 :(得分:0)
问题解决了。感谢@swapnesh
<?php $callout = array(1,2,3); ?>
<ul>
<?php foreach($callout as $call) { ?>
<li>
<?php
if ('1' == $call)
echo "a";
elseif ('2' == $call)
echo "b";
elseif ('3' == $call)
echo "c";
else
echo "d";
?>
</li>
<?php } ?>
</ul>