0

     <?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.')) { ?>

でもチャンスはない…ありがとう!

4

1 に答える 1

1

おそらくそれを変数に入れるのが最善です

$cat_title = single_cat_title();

それから

if (in_category(10) && in_category($cat_title)) { ?>
于 2010-01-29T14:36:30.377 に答える