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