Advanced Functionality
-
Hello,
I looking for help to implement some functionality, but don’t have the WordPress dev knowledge to pull it off. The details are below:
- Have a drop down menu which contains months where there are posts available, sort of like an archive thing. (How would I populate this?!)
- When the user selects a month from the drop-down, this month with be used as a parameter in the url. I.E https://www.mydomain.com/pages/folio/?filter=September
- Then, if the filter parameter is set, I want the code below (which i currently have fetching my posts) to be modified to only fetch posts from that month (which will be the value of the $_GET[‘filter’]
(This step I can do myself).
Code I currently have fetching posts:
<?php $taxonomy = 'category'; $param_type = 'category__in'; $term_args=array( 'include'=> '3', 'orderby' => 'name', 'order' => 'ASC' ); $terms = get_terms($taxonomy,$term_args); if ($terms) { foreach( $terms as $term ) { $args=array( "$param_type" => array($term->term_id), 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 10, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { $count = 0; ?> <li> <?php while ($my_query->have_posts()) : $my_query->the_post(); if ( ++$count > 1 && ($count - 1) % 2 == 0 ) echo '</li><li>' ; ?> <!-- Removed irelevant code --> <?php endwhile; ?> </li> <?php } } } wp_reset_query(); ?>
Hopefully this isn’t too ambitious, I’ve tried to include as much detail as possible.
Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Advanced Functionality’ is closed to new replies.