2010-01-29 16 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)) { ?> 
相關問題