Problem with Creating Theme Options page
-
Hi I m trying to create a theme options page but cannot manage to get the variable output in my front end, something must be off, can anyone help me out.
This is the code I have in my functions.php
add_action('admin_menu', 'add_theme_options'); function add_theme_options() { add_theme_page(__('Sidebar Banner'), __('Sidebar Banner'), 'edit_themes', basename(__FILE__), 'mitc_banner_url'); } function mitc_banner_url() { if (isset($_POST['option_submit'])) : update_option('banner_url', $_POST['linkurl']); echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>'; endif; ?> <div class="wrap"> <form id="options_form" method="post" action=""> <h2><?php _e('Banner Link URL'); ?></h2> <div class="ui-sortable"> <div class="postbox"> <h3 class="hndle"><php _e('Sub Header'); ?></h3> <div class="inside"> <div style="padding:10px;"> <div> <label for="linkurl">Banner Link URL</label> <input style="width:500px" id="linkurl" /> </div> <div class="submit"> <input type="submit" name="option_submit" id="option_submit" value="Update Options" /> </div> <?php ?> </div> </div> </div> </div> </form> </div> <?php } ?>and this one in my front end:
<?php if (get_option("banner_url")) $banner_url = get_option("banner_url"); echo $banner_url; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Problem with Creating Theme Options page’ is closed to new replies.