我有一个主页,这个不用管,其中单击菜单进入分类页面目录列表,我需要在这个列表目录显示不同的图片,如何做到,在网上找到一些代码,可是不知道加到哪个文件里,加进去又有问题。
<?php if ( get_header_image() ) : ?><a href="<?php echo esc_url( home_url( */* ) ); ?>"><img src="http://你的图片所在的网址和目录/<?php the_category_ID(); ?>.jpg" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a><?php endif; ?>
或者另一段代码:
<em>Posted in:</em><?php foreach((get_the_category()) as $cat){$catname =$cat->category_nicename;echo "<a href\"/category/";echo $catname;echo "/\">";echo "<img src\"/wp-content/cat-icons/";echo $catname;echo ".png\" alt=\"$catname category image\" border=\"0\" /></a>\n";}?>
昨天稿了一天,都没有搞好,大家有好办法不
<?php if ( get_header_image() ) : ?><a href="<?php echo esc_url( home_url( */* ) ); ?>"><img src="http://你的图片所在的网址和目录/<?php the_category_ID(); ?>.jpg" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a><?php endif; ?>
或者另一段代码:
<em>Posted in:</em><?php foreach((get_the_category()) as $cat){$catname =$cat->category_nicename;echo "<a href\"/category/";echo $catname;echo "/\">";echo "<img src\"/wp-content/cat-icons/";echo $catname;echo ".png\" alt=\"$catname category image\" border=\"0\" /></a>\n";}?>
昨天稿了一天,都没有搞好,大家有好办法不