Problem with get_posts() and form select
-
Hello, I’m new to wp plugin development. So far, I’m doing well except for this form select piece that seems to be kicking my head. I’m trying to show list of recent post in a select field for admin to select and do some stuff but the title will not show. I tried this in radio button and even text field and got no result. Please, what am I missing in this form?
<form method=\”post\”><select name=\”Article\”>”;
$args = array( ‘numberposts’ => 10, ‘order’=> ‘ASC’, ‘orderby’ => ‘title’ );
$postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post);echo”<option value=\””.the_ID().”\”>”.the_title().”</option>”;
endforeach;
echo”</select></form>”;
- The topic ‘Problem with get_posts() and form select’ is closed to new replies.