Salve colleghi sviluppatori. Sto tentando di modificare una query di Wordpress secondaria e fargli visualizzare un elenco di post in base alla categoria dei post principali. Attualmente emette l'html per lo stile del post, tuttavia non è in base alla categoria. Cosa mi manca qui? Grazie in anticipo.Provare a passare la variabile alla funzione Wordpress
<?php
$the_category = get_the_category($post->ID);
global $post;
$myposts = get_posts('numberposts=5&category='.$the_category.'');
foreach($myposts as $post) : setup_postdata($post); ?>
<li>
<div class="suggestVid">
<span style="padding-right:5px; float:left;">
<?php the_post_thumbnail('suggest-vid'); ?></span>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
</div>
</li>
<?php wp_reset_postdata(); ?>
<?php endforeach; ?>
<?php wp_reset_query(); ?>
Sembra proprio questo! Grazie mille, signor Roman! – Ken