admin管理员组文章数量:1279236
I have the following code that shows all the categories within the "category" taxonomy, it works perfectly but I need to filter so that it shows only the categories of a certain type of CPT
function show_categories_opos() {
$args = array(
'taxonomy' => 'especialidad-oposicion',
'orderby' => 'name',
'order' => 'ASC'
);
$cats = get_categories($args);
?>
<div id="convocatorias">
<?php
foreach($cats as $cat) {
$category_link = sprintf(
'<a href="%1$s" alt="%2$s">Ver más <i class="fas fa-angle-right"></i></a>',
esc_url( get_category_link( $cat->term_id ) ),
esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $cat->name ) )
);
?>
<div class="fila"><div class="columna"><?php echo $cat->name; ?></div><div class="columna"><?php echo $category_link; ?></div></div>
<?php
}
?>
</div>
<?php
}
本文标签: custom post typesFilter taxonomy by CPT
版权声明:本文标题:custom post types - Filter taxonomy by CPT 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741273327a2369586.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论