Question

I'm building a themes options page using settings API. Everything is ok, but i now i want to create a drop down list populated with pages and i don't know how to!

For example, i have this piece of code that show the list of pages, but when i select a page and cick on save, the page selected doesn't get saved!

    function  combo_select_page_callback() {
$options = get_option('journal_theme_blog_2_col');
    echo "<select name='select_page'>
 <option value=''>";
echo esc_attr( __( 'Select page' ) ); ?></option>
 <?php
  $pages = get_pages();
  foreach ( $pages as $page ) {
    $selected = '<option value="' . get_page_link( $page->ID ) . '">';
    $selected .= $page->post_title;
    $selected .= '</option>';
    echo $selected;
  }
echo '</select>';
}// end combo_select_page_callback

Thank for the help, nelson

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top