在帖子下方显示自定义分类法
发表于 : 2024年 4月 17日 15:59
将此代码添加到子主题的文件中,或通过允许添加自定义函数的插件(例如Code snippets插件)添加。避免将自定义代码直接添加到父主题的文件中,因为当您更新主题时,这将被完全擦除。functions.php
将以下代码中的“taxonomy”替换为 Taxonomy 名称
将以下代码中的“taxonomy”替换为 Taxonomy 名称
代码: 全选
/**
* Custom taxonomy section below the post
*/
if( ! function_exists( 'tie_custom_post_terms' )){
add_action( 'TieLabs/after_post_content', 'tie_custom_post_terms', 31 );
function tie_custom_post_terms(){
if( ! is_singular( 'post' ) ){
return;
}
$the_id = get_the_ID();
the_terms( $the_id, 'taxonomy', '<div class="post-bottom-meta"><div class="post-bottom-meta-title"><span class="fa fa-tags" aria-hidden="true"></span> '. esc_html__( 'Tags', TIELABS_TEXTDOMAIN ) .'</div><span class="tagcloud">', ' ', '</span></div>' );
}
}