The following snippet will display all the WordPress posts in a dropdown list.

<form action="<? bloginfo('url'); ?>" method="get"><select id="page_id" name="page_id"><!--?php
global $post;
$args = array( 'numberposts' =--> -1); $posts = get_posts($args); foreach( $posts as $post ) : setup_postdata($post); ?&gt;
<option value="<? echo $post->ID; ?>"><!--?php the_title(); ?--></option>
<!--?php endforeach; ?--></select><input name="submit" type="submit" value="view"></form>

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.