Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. $category = get_terms( 'series' );
  3. $catID = $category[0]->term_id;
  4. $args = array(
  5. 'numberposts' => 5,
  6. 'category' => $catID,
  7. 'post_type' => 'anime'
  8. );
  9. $catPosts = get_posts( $args );
  10.  
  11. echo '<form method="POST">';
  12. echo '<select name="goToPost" onchange="document.location=this.value">';
  13. echo '<option value="">'.__('Relevent Posts', 'your_text_domain').'</option>';
  14. foreach( $catPosts as $singlePost ) {
  15. echo '<option value="'.get_bloginfo('url').'/index.php?p='.$singlePost->ID.'">'.$singlePost->post_title.'</option>';
  16. };
  17. echo '</select>';
  18. echo '</form>';
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement