Hello guys im doing a customized shortcode the place the shopper can set a customized taxonomy and show in my sidebar
I wish to use a template utilizing the get_template_part
however i dont get the phrases of the taxonomy
I am utilizing the next code to show the shortcode
perform cat_widgets( $atts ) {
ob_start();
get_template_part('templates/show-taxonomy');
return ob_get_clean();
}
add_shortcode( 'cat_widgets', 'cat_widgets' );
add_filter( 'widget_text', 'do_shortcode' );
And within the show-taxonomy.php my code is
<?php
$atts = shortcode_atts( array(
'custom_taxonomy' => '',
), $atts, 'atributes' );
$terms_categorias = get_terms([
'taxonomy' => $atts['custom_taxonomy'],
'hide_empty' => false,
'orderby' => 'term_id',
'order' => 'ASC'
]);
?>
<ul class="product-categories">
<?php foreach($terms_categorias as $time period): ?>
<li class="cat-item">
<a href="<?php echo esc_url( get_term_link($term) ); ?>">
<?php echo esc_html($term->identify); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
I additionally tried to place the atts and get the phrases within the shortcode after de ob_start(); however the returns is identical
Is there one thing that im lacking?