类别 slug - 自定义 post 类型 Wordpress
Category slug - Custom post type Wordpress
使用自定义 post 类型,我需要为我的 class (css) 使用类别别名。
<?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 class="cat-resources">' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};
?>
想在我的“cat-resources class”中添加类别 slug
我该怎么做?
给你。
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 class="cat-resources '.$term->slug.'">' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};
使用自定义 post 类型,我需要为我的 class (css) 使用类别别名。
<?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 class="cat-resources">' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};
?>
想在我的“cat-resources class”中添加类别 slug
我该怎么做?
给你。
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 class="cat-resources '.$term->slug.'">' .$term->name .'</div>';
}
}
echo join( ' ', $output );
};