Php 如何使用缩略图获取wordpress类别列表?
我正在尝试获取带有缩略图图像的缩略图列表。我尝试了下面的代码,但它只提供类别列表。我知道使用feed_图像可以做到,但我不知道怎么做。请帮助我,我只是wordpress的初学者Php 如何使用缩略图获取wordpress类别列表?,php,json,wordpress,api,echo,Php,Json,Wordpress,Api,Echo,我正在尝试获取带有缩略图图像的缩略图列表。我尝试了下面的代码,但它只提供类别列表。我知道使用feed_图像可以做到,但我不知道怎么做。请帮助我,我只是wordpress的初学者 $args = array( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'sh
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 0,
'hide_empty' => 1,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => __( 'Categories' ),
'show_option_none' => __( 'No categories' ),
'number' => null,
'echo' => 1,
'depth' => 0,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'category',
'walker' => null
);
echo wp_list_categories( $args );
Wordpress
类别没有内置的“猫图像”
您必须通过更改核心代码或使用描述字段作为图像路径的假字符串保持器来添加此字段
<img src="<?php echo category_description( $category_id ); ?>" />
另一个解决方案是使用插件
我不能使用html标记。我正在制作rest api,我需要一个数组中的url,以便我可以编码为json。@warzone_fz这只是一个以html格式输出内容的示例代码。实际内容可以放入一个数组中(或者已经在循环中)
feed_image---
(string) Set a URI for an image (usually an rss feed icon) to act as a link to each
categories' rss-2 feed. This parameter overrides the feed parameter. There is no default
for this parameter.