我正在使用以下代码根据查看者所在的页面或类别显示特定的标题图形:
<!-- Custom Design masthead -->
<?php if ( is_page(259) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-1.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<!-- About and sub-pages masthead -->
<?php } elseif ( is_page(array(245,348,352,357,325)) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-2.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<!-- Design Community masthead -->
<?php } elseif ( is_page(array(365,568)) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-3.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<!-- Contact and Privacy masthead -->
<?php } elseif ( is_page(array(264,330)) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-4.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<!-- Blog masthead -->
<?php } elseif ( is_category(4) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-5.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<?php } else { ?>
<?php bloginfo('template_directory'); ?>/images/masthead-0.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
<?php }?>
到目前为止,一切都很好。我遇到的问题是如何修改以下语句:
<!-- Blog masthead -->
<?php } elseif ( is_category(4) ) { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/masthead-5.jpg" width="1140" height="250" alt="Custom Acrylic Furniture" />
以便它包括类别和任何子类别。
任何帮助表示赞赏!