Posted By

kenjosan on 10/24/11


Tagged

wordpress


Versions (?)

View wp-posts in dropdown


 / Published in: PHP
 

  1. <form action="<? bloginfo('url'); ?>" method="get">
  2. <select name="page_id" id="page_id">
  3. <?php
  4. global $post;
  5. $args = array( 'numberposts' => -1);
  6. $posts = get_posts($args);
  7. foreach( $posts as $post ) : setup_postdata($post); ?>
  8. <option value="<? echo $post->ID; ?>"><?php the_title(); ?></option>
  9. <?php endforeach; ?>
  10. </select>
  11. <input type="submit" name="submit" value="view" />
  12. </form>

Report this snippet  

You need to login to post a comment.