can help me?
I'm trying to get part of name to taxonomy.
Taxonomy slug: temporada-01
I only need the number: 01
I've this code, but this display the name.
<?php
$terms = get_the_terms( $post->ID , 'temporada' );
if ( $terms != null ){
foreach( $terms as $term ) {
print $term->name;
unset($term);
}
}
?>
How can retrieve part of the name?
Thanks.
Try a preg_replace() function which will only keep digits:
print preg_replace( '/[^0-9]/', '', $term->name );