使用自定義帖子型別,我需要為我的班級 (css) 使用類別 slug。
<?php
global $post;
$terms = wp_get_post_terms($post->ID, 'typeresources');
if ($terms) {
$output = array();
foreach ($terms as $term) {
if ($term->term_id != 14)
{
$output[] = '<div >' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};
?>
想在我的“cat-resources class”中添加 categroy slug
我怎樣才能做到這一點 ?
uj5u.com熱心網友回復:
你去吧。
global $post;
$terms = wp_get_post_terms($post->ID, 'typeresources');
if ($terms) {
$output = array();
foreach ($terms as $term) {
if ($term->term_id != 14) {
$output[] = '<div hljs-variable">$term->slug.'">' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/331145.html
