Pages

Saturday, October 6, 2012

Create Extra Menu in wordpress


Please write below code in "function.php"

// create custom plugin settings menu
add_action('admin_menu', 'social_create_menu');
function social_create_menu() {
    add_menu_page('Theme Settings', 'Theme Settings', 'administrator', __FILE__, 'social_settings_page','../images/social_windows_button.png');
    add_action( 'admin_init', 'register_mysettings' );
}
function register_mysettings() {
    register_setting( 'social-settings-group', 'facebook_link' );
}
function social_settings_page() {    ?>
<div class="wrap"><br>
<fieldset style="border: 1px solid #cccccc; padding: 10px; margin: 10px 0;">
<legend style="font-size:18px;">Social Links</legend>
<form method="post" action="options.php">
    <?php settings_fields( 'social-settings-group' ); ?>
    <table class="form-table">
        <tr valign="top"><td style="width:125px;"><img src="../images/social_facebook.png" style="vertical-align: middle;" title="Facebook" alt="Facebook">&nbsp;Facebook</td><td><input type="text" name="facebook_link" value="<?php echo get_option('facebook_link'); ?>" style="width:300px;"></td></tr>          
    </table>
</fieldset>
 <p class="submit">
    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
    </p>
</form>
</div>
<?php }

/* Create admin menu Ends */

No comments: