php - Place Wordpress "Site Title" function within "Theme Options" page -


i've created "theme-options.php" page within wordpress, can found under wp api "appearance" settings menu. on this page include 2 things from settings > general-options page (the site title , tagline/subheading) can edited here (on theme options page) , saved..

how go achieving this? have far, displays boxes , information needed, not save/update properly. missing?

theme-options.php :

// build our page function build_options_page() {  // page structure    ob_start(); ?>      <div class="wrap">        <?php screen_icon();?>        <h2>theme options</h2>         <p><b><label for="blogname"><?php _e('site title') ?></label></b></p>        <p><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" />          <span class="description"><?php _e('the name of site.') ?></span></p>         <br />         <p><b><label for="blogdescription"><?php _e('tagline or subheading') ?></label></b></p>        <p><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />         <span class="description"><?php _e('a brief description of site.') ?></span></p>         <p class="submit">        <input name="submit" type="submit" class="button-primary" value="<?php esc_attr_e('save changes'); ?>" />        </p>       </div>    <?php    echo ob_get_clean();    ?> } 

this example uses profile page display , modify blogname , blogdescription, should pretty straight forward port code.

add_action( 'show_user_profile', 'show_extra_profile_fields', 1 ); add_action( 'edit_user_profile', 'show_extra_profile_fields', 1 );  function show_extra_profile_fields( $user ) {      ?>     <table class="form-table">           <tr>             <th><label for="user_address">site title</label></th>             <td>                 <input type="text" name="blogname" id="blogname" value="<?php echo esc_attr( get_option('blogname') ); ?>" class="regular-text" /><br />                 <span class="description"></span>             </td>         </tr>         <tr>             <th><label for="user_zip">tagline</label></th>             <td>                 <input type="text" name="blogdescription" id="blogdescription" value="<?php echo esc_attr( get_option( 'blogdescription' ) ); ?>" class="regular-text" /><br />                 <span class="description"></span>             </td>         </tr>            </table>     <?php  }  add_action( 'personal_options_update', 'save_extra_profile_fields' ); add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );  function save_extra_profile_fields( $user_id ) {      if ( !current_user_can( 'edit_user', $user_id ) )         return false;      update_option( 'blogname', $_post['blogname'] );     update_option( 'blogdescription', $_post['blogdescription'] ); } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -