select dropdown list | WordPress.org

Hello,

Can someone help me pls.

I have a page in wordpress where I want to display the content of a post (The title, the excerpt, the thumbnail and date).

I have this code below, that work. But I want this content change when I choose from an select box, with the categories of the posts. The select box must have the categories and after I choose an specific category a list of posts with (The title, the excerpt, the thumbnail and date) of that category should appear.


<?php
 $postslist = get_posts('category=4&numberposts=1&order=DESC&orderby=date');
 foreach ($postslist as $post) :
    setup_postdata($post);
 ?>
 
 <?php echo get_the_post_thumbnail( $page->ID, array( 607, 370) ); ?>

<?php 
    foreach((get_the_category()) as $category){
       echo "<p>".$category->name."<p>";
        }
    ?>
<?php the_title(); ?></a>

<?php the_excerpt(__('(more…)')); ?>

 <?php endforeach; ?>

Thank you very much

Nuno Nascimento



Source link