Ciao a tutti,
ho creato due widget, uno per visualizzare i post più commentati e uno per visualizzare i post random.
Per non trovarmi con post duplicati nel widget degli articoli random, colleziono gli id degli articoli visualizzati nel loop principale e nel loop del widget post ù commentati con
$do_not_duplicate[] = $post->ID;
Il problema è che sembra che il loop dei widget abbia la priorità su quello del loop principale…infatti facendo un var_dump all’interno del widget non compare l’id dell’articolo principale ma solo quelli del widget articoli più commentati. Al contrario facendo un var_dump all’interno del loop principale visualizzo tutti gli id!
I widget vengono hookati a widget_init…
Spero di essere stato chiaro.
Grazie!