Buon giorno a tutti, ho un quesito riguardo una funzione per nascondere e mostrare elementi di una tabella in wordpress.
Ho creato un ciclo che mostra una tabella con questi elementi tra i quali le categorie create in wordpress:
<?php
$args = array( 'post_type' => 'documenti_utili', 'posts_per_page' => 50 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<tr class="';
echo get_the_category($id)[0]->term_id;
echo '">';
echo '<td>';
the_category( $id );
echo '</td>';
echo '<td>';
the_title();
echo '</td>';
echo '<td>';
echo '<a class="grida" href="';
the_field( "file_archivio" );
echo '"title="';
the_title();
echo '" target="_blank">';
echo '<img src="/pdf-icon.png" />';
echo "</a>";
echo '</td>';
echo '</tr>';
endwhile;?>
Mi sono poi creato una select che pesca le categorie:
<select onchange="fiter_category(this)">
<?php
//Altre Categorie
$categories = get_categories();
foreach ($categories as $category) {
$option = '<option value="'.$category->cat_ID.'">';
$option .= $category->cat_name;
$option .= '</option>';
echo $option;
}
?>
</select>
Avrei bisogno ora di creare la funzione con jquery che mostra solo le categorie selezionate dalla select.
Qualche idea?
Purtroppo non sono espertissimo e cercando in giro non sono riuscito a trovare la soluzione.
Grazie![]()