I'm making a shortcode to return all the terms in this taxonomy. The terms are sorted with krsort by the custom field 'height' made from ACF. I'm following this answer from here.
The problem is it's only displaying 8 terms and there's 15 in total. All of these terms have the custom field filled out and have posts for them so I'm not sure.
I need this object array because I will be displaying other parameters in foreach.
function taxonomies_shortcode( $atts ) {
extract( shortcode_atts(
array(
'taxonomy' => 'taxonomy',
), $atts
));
$args = array(
'taxonomy' => $taxonomy,
);
$terms = get_terms( $args );
$newterms = array();
foreach($terms as $term) {
$order = get_field( 'height', $term );
$newterms[$order] = (object) array(
'name' => $term->name,
'slug' => $term->slug,
'term_id' => $term->term_id
);
}
ksort( $newterms, SORT_NUMERIC );
foreach ( $newterms as $newterm ) {
$html .= '<a href="#' . $newterm->slug . '">' . $newterm->name . '</a>';
}
return $html;
}
add_shortcode( 'taxonomies', 'taxonomies_shortcode' );
Would appreciate any help, thanks!