Hello friends i want so image and description in categories list widget for showing description i use below code:
in function.php
IOptions<AppSettings>
and in class-wp-widget-categories.php
function wpb_catlist_desc() {
$string = '<ul>';
$catlist = get_terms( 'category' );
if ( ! empty( $catlist ) ) {
foreach ( $catlist as $key => $item ) {
$string .= '<li>'. $item->name . '<br />';
$string .= '<em>'. $item->description . '</em> </li>';
}
}
$string .= '</ul>';
return $string;
}
add_shortcode('wpb_categories', 'wpb_catlist_desc');
it is showing categories name and his description now i want to show categories image also. any one please help me how can i get that. i had try Categories Images plugin for show images but can't able to show
答案 0 :(得分:0)
图片获取z_taxonomy_image_url($id)
和z_taxonomy_image($id)
if(z_taxonomy_image_url($item->term_id))
{
$string .= '<img src ="'.z_taxonomy_image_url($item->term_id).'" style="width: 20%;">';
}
答案 1 :(得分:0)
您可以使用以下代码获取图像并将其附加到$ string。
quote['SellTime'].head()
Out[32]:
0 94520
1 94538
2 94609
3 94615
4 94617
Name: SellTime, dtype: object