Hello David13_13,
If you want to use a shorter name of your category Either you use substr function which allows you cut your string to short.So below will gives you the first 3 letters pf your category name:
$cat_name = substr($cat_name, 0, 2)
OR
If you want add your shorter name to the category you can use the add term meta which will provide you the custom field for adding the custom meta.Please follow below link if you want to add the custom meta filed to your category:
https://pippinsplugins.com/adding-custom-meta-fields-to-taxonomies/
Thanks
Hey!
Thanks a lot for the reply.
I’m going to need to use term meta, because I only can use 2 letters and if I use substr some texonomies start with the same 2 letters (Presentaciones and Proyectos Fin de Carrera…)
So I have to create a new term short meta name using the second method that you have provided. My question is:
How I later call the permalink, the title and the short name for generate the “a ref”. I want that the link display the short title, if you pass the mouse over it it display in a title tag the complete name and it is clickeable to go to the taxonomy page. Something like this code:
<a href="<?php the_permalink();?>" title="<?php the_title(); ?>" class="project-item-title">
<?php the_title(); ?>
</a>
But I don’t know how to combine this with the function that I was using at the moment that is:
<?php echo get_the_term_list( $post->ID, 'tipo_de_tarea' );
?>
To call all of the necessary terms…
And how can I solve the problem of to add a specific class for each taxonomy to can assign different background color for them?
Thanks a lot!
Hello David13_13,
With reference to our solution in above comment, please create a new custom meta so as to add color class for the custom taxonomy.
So when we add a new custom taxonomy a new field would be available in admin to add desired CSS class for specific colors.
And in template please include following code snippet
class="get_term_meta ( int $term_id, string $key = 'your-meta key', bool $single = false )"
to the category HTML and also add color related css styles for those class in templates style.css
Please try this solution.Let us know if need any further help on the same.
Thanks
Thanks a lot for your answer.
However, with your code, I didn’t get this as I said in my previous message:
I want that the link display the short title, if you pass the mouse over it it display in a title tag the complete name and it is clickeable to go to the taxonomy page. Something like this code:
<a href="<?php the_permalink();?>" title="<?php the_title(); ?>" class="project-item-title">
<?php the_title(); ?>
</a>
But I don’t know how to combine this with the function that I was using at the moment that is:
<?php echo get_the_term_list( $post->ID, 'tipo_de_tarea' );
?>
To call all of the necessary terms…