baw_create_menu

// create custom plugin settings menu
add_action(‘admin_menu’, ‘baw_create_menu’);

function baw_create_menu() {

//create new top-level menu
add_menu_page(‘Social Media ‘, ‘Social Media Settings’, ‘administrator’, __FILE__, ‘baw_settings_page’,admin_url(). ‘images/index.jpg’);

//call register settings function
add_action( ‘admin_init’, ‘register_mysettings’ );
}

function register_mysettings() {
//register our settings
register_setting( ‘baw-settings-group’, ‘play_facebook’ );
register_setting( ‘baw-settings-group’, ‘play_twitter’ );
register_setting( ‘baw-settings-group’, ‘play_linkdin’ );
register_setting( ‘baw-settings-group’, ‘play_bb’ );
register_setting( ‘baw-settings-group’, ‘play_wpress’ );
register_setting( ‘baw-settings-group’, ‘play_pintrest’ );
register_setting( ‘baw-settings-group’, ‘play_gplus’ );
register_setting( ‘baw-settings-group’, ‘play_contactus’ );
register_setting( ‘baw-settings-group’, ‘play_map’ );
register_setting( ‘baw-settings-group’, ‘play_mailto’ );
register_setting( ‘baw-settings-group’, ‘play_adminemail’ );
register_setting( ‘baw-settings-group’, ‘play_youtube’ );

register_setting( ‘baw-settings-group’, ‘play_video’ );
register_setting( ‘baw-settings-group’, ‘play_phone1’ );
register_setting( ‘baw-settings-group’, ‘play_phone2’ );
register_setting( ‘baw-settings-group’, ‘play_copyright’ );

}

function baw_settings_page() {
?>
<script type=”text/javascript”>
jQuery(document).ready(function() {
jQuery(“#first_formost”).addClass(“mceEditor”);
if ( typeof( tinyMCE ) == “object” &&
typeof( tinyMCE.execCommand ) == “function” ) {
tinyMCE.execCommand(“mceAddControl”, false, “first_formost”);
}
});
</script>

<h2>Social Media</h2>
<form method=”post” action=”options.php”>
<?php settings_fields( ‘baw-settings-group’ ); ?>
<div>
<?php include(‘inc/tabsettings.php’); ?>
<?php submit_button(); ?>
</div>

</form>
<?php
}

//tab.php

<style>
.tooscontainer
{
width:92%;
margin:0 auto;
min-height:700px;
min-height:600px;
background:#F3F3F5;
}
.toolmenu > ul {
margin: 0;
padding: 13px 2px !important;
}
.toolmenu li {
background: none repeat scroll 0 0 #379BED;
border-radius: 2px;
display: inline;
font-size: 17px;
list-style-type: none;
padding: 0 17px 3px 10px;
text-decoration: none;
}
.toolmenu a {
text-decoration: none;
}
.inactive{
color: #FFFFFF;
}
.
{
color:#EDF0F2;
}
.toolmenu a:hover {
color:#ccc;
}
.toolleft {
float: left;
min-height: 500px;
border:1px dotted #ccc;
width:629px;
}
.toolright {
float: left;
min-height: 500px;
width: 560px;
border:1px dotted #ccc;
background:#E5F2E1;
}
.toolleftin{
display: none;
}
.toolcontent
{
width:70%;
height:70%;
margin: 0 auto;
}
.backimg
{
min-height:300px;
}
.custom li {
border-bottom: 1px dotted #CCCCCC;
padding: 5px 16px;
}
.custom li:last-child{border:none;}
.custom p {
margin: 0;
}
.custom input {
padding: 4px;
width: 300px;
}

.custom > h3 {
color: #5F6263;
font-size: 21px;
font-weight: bold;
padding-left: 15px;
}
.form-section p.submit{clear:both;}
</style>
<script src=”<?php echo bloginfo(‘template_directory’); ?>/js/jquery-1.9.1.min.js”></script>
<script>
$(document).ready(function(){

$(‘.toolmenu ul li a:not(:first)’).addClass(‘inactive’); $(‘#chooseproduct’).css(‘display’,’block’);
$(‘.toolmenu ul li a’).click(function(){
var t = $(this).attr(‘href’);
$(‘.toolmenu ul li a’).addClass(‘inactive’);
$(this).removeClass(‘inactive’);
$(‘.toolleftin’).css(‘display’,’none’);
$(t).css(‘display’,’block’);
return false;
});

});
</script>

<div>
<ul>
<li><a href=”#chooseproduct”>Social Media Settings</a></li>
<li><a href=”#choosedesign”>General Settings</a></li>
<li><a href=”#addtext”>ContactUs Settings</a></li>
</ul>
</div>
<div>
<div  id=”chooseproduct”>
<div>
<h3>Social Media Settings</h3>
<ul>
<li><label>Facebook:</label><p> <input type=”text” name=”play_facebook”  style=””value=”<?php echo get_option(‘play_facebook’); ?>”/></p></li>
<li><label>Twitter:</label><p> <input type=”text” name=”play_twitter”  style=””value=”<?php echo get_option(‘play_twitter’); ?>”/></p></li>
<li><label>Linkidin:</label><p> <input type=”text” name=”play_linkdin”  style=””value=”<?php echo get_option(‘play_linkdin’); ?>”/></p></li>
<li><label>Google+:</label><p> <input type=”text” name=”play_gplus”  style=””value=”<?php echo get_option(‘play_gplus’); ?>”/></p></li>
<li><label>Wordpress:</label><p> <input type=”text” name=”play_wpress”  style=””value=”<?php echo get_option(‘play_wpress’); ?>”/></p></li>
<li><label>BB:</label><p> <input type=”text” name=”play_bb”  style=””value=”<?php echo get_option(‘play_bb’); ?>”/></p></li>
<li><label>Youtube:</label><p> <input type=”text” name=”play_youtube” style=””value=”<?php echo get_option(‘play_youtube’); ?>”/></p></li>
<li><label>Pintrest:</label><p> <input type=”text” name=”play_pintrest” style=””value=”<?php echo get_option(‘play_pintrest’); ?>”/></p></li>

</ul>
</div>
</div>

<div id=”choosedesign”>
<div>
<h3>General Settings</h3>
<ul>
<li><label>Home video:</label><p> <input type=”text” name=”play_video”  style=””value=”<?php echo get_option(‘play_video’); ?>”/></p></li>
<li><label>Copy Right</label><p> <input type=”text” name=”play_copyright”  style=””value=”<?php echo get_option(‘play_copyright’); ?>”/></p></li>

</ul>
</div>
</div>

<div id=”addtext”>
<div>
<h3>Contact Us Settings</h3>
<ul>
<li><label>Contact Us</label><p>
<?php
$settingss = array(
‘textarea_name’ => ‘play_contactus’,
‘textarea_id’ => ‘play_contactus’,
‘media_buttons’ => false,
‘textarea_rows’ =>13,
‘textarea_cols’ =>50,
);
wp_editor( get_option(‘play_contactus’), ‘play_contactus’, $settingss );
?>
</p></li>

<li><label>Map</label><p>
<?php
$settingss = array(
‘textarea_name’ => ‘play_map’,
‘textarea_id’ => ‘play_map’,
‘media_buttons’ => false,
‘textarea_rows’ =>13,
‘textarea_cols’ =>50,
);
wp_editor( get_option(‘play_map’), ‘play_map’, $settingss );
?>
</li>

<li><label>Mail To: </label><p><input type=”text” name=”play_mailto”  style=””value=”<?php echo get_option(‘play_mailto’); ?>”/></p></li>
<li><label>Admin Email: </label><p><input type=”text” name=”play_adminemail”  style=””value=”<?php echo get_option(‘play_adminemail’); ?>”/></p></li>
<li><label>Header Phone: 1</label><p><input type=”text” name=”play_phone1″  style=””value=”<?php echo get_option(‘play_phone1’); ?>”/></p></li>

<li><label>Header Phone: 2</label><p><input type=”text” name=”play_phone2″  style=””value=”<?php echo get_option(‘play_phone2’); ?>”/></p></li>

</ul>
</div>
</div>
</div>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s