php添加css语句,如何将 css 类添加到我的示例 php 代码中

我想在这段php代码的输出中添加一个类

function acf_esg_tax_field_loc( $atts, $content = null ) {

$a = shortcode_atts(array('post_id' => "1"), $atts);

$term = get_field( "field_56cb3d84cf32a", $a['post_id'] );

echo $term->name;

}

add_shortcode( 'acfesgtax_loc', 'acf_esg_tax_field_loc' );

该代码用于我的 Wordpress 函数 php 以生成短代码。

它应该是这样的

function acf_esg_tax_field_loc( $atts, $content = null ) {

$a = shortcode_atts(array('post_id' => "1"), $atts);

$term = get_field( "field_56cb3d84cf32a", $a['post_id'] );

echo '

';

echo $term->name;

echo '

';

}

add_shortcode( 'acfesgtax_loc', 'acf_esg_tax_field_loc' );

不幸的是,这不起作用。

你能帮忙吗?