How to Call pages from a Options Panel

Need a little bit of help here. I am adding this dropdown to my options panel. However, when I call my option in my template. It does not display

Here is the function for the dropdown:

Read More
    function page_test_setting(){
    $options = get_option('meta_options');
    $pages = get_pages(); 
    echo '<select name="meta_options[page_test]">'; 
    echo "<option value='{$options['page_test']}'>";
    echo esc_attr( __( 'Select page' ) );
    echo "</option>"; 
    foreach ( $pages as $page ) {
    $option = '<option value="' . get_page_link( $page->ID ) . '">';
    $option .= $page->post_title;
    $option .= '</option>';
    echo $option;
    echo '</select>';
    }
    }

The options field:

    add_settings_field('page_test', 'PAGE OUTPUT', 'page_test_setting', __FILE__, 'meta_section');

And here is how I am calling it in my theme:

   <?php echo get_permalink($options['page_test']); ?>

As you can probably guess is that I want the CALL to pull the page title and link to the appropiate page. Should I be using page titles instead for the call or what?

Related posts

Leave a Reply

1 comment

  1. Okay, I found the solution incase anyone else is need to do the same thing.

     function music_link_setting (){
        $options = get_option('kw_theme_options');
        wp_dropdown_pages(
        array(
             'name' => 'kw_theme_options[music_link]',
             'echo' => 1,
             'show_option_none' => __( '&mdash; Select &mdash;' ),
             'option_none_value' => '0',
             'selected' => $options['music_link']
        )
    );
    

    }