无法将 WooCommerce 类别描述放在类别框下
Can't put WooCommerce category description under a category box
我试图在存档页面的每个类别上输出 WooCommerce 类别描述。我设法在主题 WooCommerce 模板中做到了这一点,但我也想在 functions.php 中做到这一点。
目前是这样的:
// Short text under a category box on archive page
function desc_cat_funct() {
// trying to get a category information
$desc_cat = category_description($category);
// some css
$desc_cat_res = '<span class="cat-info">'.$desc_cat.'</span>';
// trying to output but kaput...
echo $desc_cat_res;
}
add_action( 'woocommerce_after_subcategory', 'desc_cat_funct');
这只输出 html 但不输出其中的 php 信息。我怎样才能让 php 显示或回显正确的输出?
// Short text under a category box on archive page
function desc_cat_funct($category) {
// trying to get a category information
$desc_cat = category_description($category);
// some css
$desc_cat_res = '<span class="cat-info">'.$desc_cat.'</span>';
// trying to output but kaput...
echo $desc_cat_res;
}
add_action( 'woocommerce_after_subcategory', 'desc_cat_funct');
我试图在存档页面的每个类别上输出 WooCommerce 类别描述。我设法在主题 WooCommerce 模板中做到了这一点,但我也想在 functions.php 中做到这一点。
目前是这样的:
// Short text under a category box on archive page
function desc_cat_funct() {
// trying to get a category information
$desc_cat = category_description($category);
// some css
$desc_cat_res = '<span class="cat-info">'.$desc_cat.'</span>';
// trying to output but kaput...
echo $desc_cat_res;
}
add_action( 'woocommerce_after_subcategory', 'desc_cat_funct');
这只输出 html 但不输出其中的 php 信息。我怎样才能让 php 显示或回显正确的输出?
// Short text under a category box on archive page
function desc_cat_funct($category) {
// trying to get a category information
$desc_cat = category_description($category);
// some css
$desc_cat_res = '<span class="cat-info">'.$desc_cat.'</span>';
// trying to output but kaput...
echo $desc_cat_res;
}
add_action( 'woocommerce_after_subcategory', 'desc_cat_funct');