0

我使用分类图像插件来存储每个类别的图像。现在我想显示类别图像。但我找不到任何设置来显示这些图像。有没有更好的插件来显示具有类别名称的类别图像。

4

1 回答 1

0

要显示类别图像,只需使用以下命令:

$terms = apply_filters( 'taxonomy-images-get-terms', '' );
if ( ! empty( $terms ) ) {
    print '<ul>';
    foreach( (array) $terms as $term ) {
        print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
    }
    print '</ul>';
}

默认显示“类别”

于 2013-03-23T11:42:46.110 回答