Created
September 8, 2015 07:44
-
-
Save goliver79/137164f2146dc79f562d to your computer and use it in GitHub Desktop.
[WORDPRESS] Show all posts in a combobox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="<? bloginfo('url'); ?>" method="get"> | |
<select name="page_id" id="page_id"> | |
<?php | |
global $post; | |
$args = array( 'numberposts' => -1); | |
$posts = get_posts($args); | |
foreach( $posts as $post ) : setup_postdata($post); ?> | |
<option value="<? echo $post->ID; ?>"><?php the_title(); ?></option> | |
<?php endforeach; ?> | |
</select> | |
<input type="submit" name="submit" value="view" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment