<?php
$args=array(
'post_type'=>'page',//查找出所有页面(多个结果集,复数)
'showposts'=>2
);
// 实例化wp_query
$the_query = new WP_Query( $args );
// 开始循环
if ( $the_query->have_posts() ) {//如果找到了结果,便输出以下内容
while ( $the_query->have_posts() ) {
$the_query->the_post();
//这里开始输出你想要的模板标签
echo '<h4 class="wow animated myred f-fc-4"><a href="/#">'.get_the_title().'</a></h4>';
echo '<h4 class="wow animated myred f-fc-5"><a href="/#">'.get_the_title().'</a></h4>';
?>
<!-- <h4 class="wow animated myred f-fc-4"><a href="/#"><?php the_title();?></a></h4>-->
<?php
}
}
wp_reset_postdata();//不用问为什么,每次都记得写就好
$the_query = new WP_Query( $args );
?>
各位大神请看,我一共想显示两个不同页面的title但是格式不同 ,就是那两个echo输出的。请问我怎么可以第一次输出第一个title,第二次输出第二个,感激不尽.....
$args=array(
'post_type'=>'page',//查找出所有页面(多个结果集,复数)
'showposts'=>2
);
// 实例化wp_query
$the_query = new WP_Query( $args );
// 开始循环
if ( $the_query->have_posts() ) {//如果找到了结果,便输出以下内容
while ( $the_query->have_posts() ) {
$the_query->the_post();
//这里开始输出你想要的模板标签
echo '<h4 class="wow animated myred f-fc-4"><a href="/#">'.get_the_title().'</a></h4>';
echo '<h4 class="wow animated myred f-fc-5"><a href="/#">'.get_the_title().'</a></h4>';
?>
<!-- <h4 class="wow animated myred f-fc-4"><a href="/#"><?php the_title();?></a></h4>-->
<?php
}
}
wp_reset_postdata();//不用问为什么,每次都记得写就好
$the_query = new WP_Query( $args );
?>
各位大神请看,我一共想显示两个不同页面的title但是格式不同 ,就是那两个echo输出的。请问我怎么可以第一次输出第一个title,第二次输出第二个,感激不尽.....

