admin管理员组文章数量:1302292
I'd love to place the category description just after the main title in a span, like a subtitle.
add_filter ('woocommerce_page_title', function ($title) {
// what should be here?
$title .= "<span class='subtitle'>{$description}</span>";
return $title;
});
Thanks.
I'd love to place the category description just after the main title in a span, like a subtitle.
add_filter ('woocommerce_page_title', function ($title) {
// what should be here?
$title .= "<span class='subtitle'>{$description}</span>";
return $title;
});
Thanks.
Share Improve this question asked Oct 4, 2013 at 13:02 mircobabinimircobabini 1541 gold badge1 silver badge9 bronze badges 1- Please follow up on the questions you asked, it's an important part of the process on WPSE - see What should I do when someone answers my question? and Why is voting important? for a deeper insight. Thank you! – Nicolai Grossherr Commented Nov 7, 2013 at 12:52
2 Answers
Reset to default 2There is an extra hook you can use for this woocommerce_archive_description
, hook into it like this:
add_action( 'woocommerce_archive_description', 'wc_category_description' );
function wc_category_description() {
if ( is_product_category() ) {
global $wp_query;
$cat_id = $wp_query->get_queried_object_id();
$cat_desc = term_description( $cat_id, 'product_cat' );
$subtit = '<span class="subtitle">'.$cat_desc.'</span>';
echo $subtit;
}
}
Try this in your archive-product.php template:
<span class="subtitle">
<?php do_action( 'woocommerce_archive_description' ); ?>
</span>
本文标签: pluginsWoocommerce category description as subtitle
版权声明:本文标题:plugins - Woocommerce category description as subtitle 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741701157a2393297.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论