2010-01-29 67 views
0

WordPress的:如何把一个函数内PHP?

 <?php 

    if (is_category()) 

    echo single_cat_title(); 

    ?> 

我可以显示当前类别冠军。

我怎样才能插入标签single_cat_title()到:

<?php 
$recent = new WP_Query("cat=10&showposts=4"); while($recent->have_posts()) : $recent->the_post(); 

    if (in_category(10) && in_category(**Insert Here**)) { ?> 

试了一下
if (in_category(10) && in_category('.single_cat_title.')) { ?> 

但没有机会... 谢谢!

回答

1

,所以最好把它变成一个变量

$cat_title = single_cat_title(); 

然后

if (in_category(10) && in_category($cat_title)) { ?> 
相关问题