Just cut and paste to show all posts in that category
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php // FIRST CATEGORY NAME $category = get_the_category(); $catID = $category[0]->term_id; $args = array( 'numberposts' => 25, 'category' => $catID ); $catPosts = get_posts( $args ); echo '<form method="POST">'; echo '<select name="goToPost" onchange="document.location=this.value">'; echo '<option value="">'.__('Relevent Posts', 'your_text_domain').'</option>'; foreach( $catPosts as $singlePost ) { echo '<option value="'.get_bloginfo('url').'/index.php?p='.$singlePost->ID.'">'.$singlePost->post_title.'</option>'; }; echo '</select>'; echo '</form>'; ?> |
OR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?php $cat_id = get_cat_ID('uncategorized'); $args=array( 'cat' => $cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { ?> <form name="jump"> <select name="menu"> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <option value="<?php the_permalink() ?>"><?php the_title(); ?></option> <?php endwhile; } ?> </select> <input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="Go"> </form> <?php wp_reset_query(); ?> |