Solution:1
I use get_posts
to display a dropdown with all posts in a plugin settings page:
public function posts_html()
{
$value = get_option( 'especial_edit_post' );
$args = array( 'numberposts' => -1 );
$posts = get_posts( $args );
echo "<select name='especial_edit_post' id='especial_edit_post'>";
$selected = selected( '', $value, false );
echo "<option value='' {$selected}>-none-</option>";
foreach( $posts as $post )
{
$selected = selected( $post->ID, $value, false );
echo "<option value='{$post->ID}' {$selected}>{$post->post_title}</option>";
}
echo '</select>';
}