0
I am displaying all categories with their respective images, according to the code below:
<?php
categorias = apply_filters('taxonomy-images-get-terms', '', array( 'taxonomy' => 'category') );
foreach($categorias as $key => $categoria):
if($key < 6):
?>
<div class="box">
<a href="<?php echo get_category_link($categoria->term_id);?>">
<figure>
<?php echo wp_get_attachment_image($categoria->image_id,''); ?>
</figure>
<img src="<?php bloginfo('template_directory');?>/images/icones/plus.png" class="plus-icone" alt="">
<figcaption class="titulo-foto-categoria"><?php echo $categoria->name;?></figcaption>
</a>
</div>
<?php
endif;
endforeach;?>
The function was used apply_filters
to be able to display the image of the category, as far as I could find on the internet only that way it is possible to do this. From what I noticed this function shows all the results in alphabetical order and I need to show them randomly or by date.
It is possible to do this?
You talk about reordering by date, but you don’t have a date reference in the code. If you know which parameter brings this information I can put an example.
– Ricardo Moraleida
I have no way to test now, but getting shuffled will already solve my problem. Tomorrow early I will test. Thank you very much.
– Julio Cesar
Ricardo, you did it right, I thank you again for your help. I had not even thought to search a way to reorder the array, I focused on the functions of Wordpress.
– Julio Cesar