我正在尝试开发两个不同的模板;一个类别列表的布局和一个单独的子类别布局。
我相信它需要一个条件语句来检测当前类别是类别还是子类别。
我熟悉:
<?php if (is_category('Category A')) : ?>
<p>This is the text to describe category A</p>
<?php elseif (is_category('Category B')) : ?>
<p>This is the text to describe category B</p>
<?php else : ?>
<p>This is some generic text to describe all other category pages,
I could be left blank</p>
<?php endif; ?>
但我需要它更加动态并处理任何类别或子类别,而无需对猫 ID 号进行硬编码。
任何帮助将不胜感激,在此先感谢您。