Add URL to selected post in meta box

Question

How can I change this code

$posts = get_posts(array('post_type'=> 'lesson', 'post_status'=> 'publish', 'suppress_filters' => false, 'posts_per_page'=>-1));
        //here you add the HTML of the dropdown you add something like

        echo '<p>Select the lesson: <select name="_dappcf_i_dropdown" class="widefat"  style="width:170px" >';
        foreach ($posts as $post) {
        echo '<option value="', $post->ID, '"'; if  ($my_dropdown == $post->ID){echo ' selected="selected"';} echo '>'.$post->post_title.'</option>';

        }
    echo '</select>';    
}

to echo the title of the selected post in page template with the URL of of SELECTED post(the title should be a link)?

Thanks in advance

0
, Robert Zalinyan 7 years 2016-03-17T01:31:50-05:00 0 Answers 57 views 0

Leave an answer

Browse
Browse