Created
September 13, 2012 17:49
-
-
Save kragen/3716165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function basic_bs_register_settings() { | |
register_setting('basic_bs_settings_group', 'basic_bs_settings'); | |
} | |
add_action('admin_init', 'basic_bs_register_settings'); | |
$basic_bs_options = get_option('basic_bs_settings'); | |
function business_tools_admin_menu() { | |
add_menu_page( __('Basic Store Settings', 'basic'), __('Basic Store Settings', 'basic'), 'edit_theme_options', 'business_tools', 'business_tools_page'); | |
} | |
add_action('admin_menu', 'business_tools_admin_menu'); | |
function business_tools_page() { | |
global $basic_bs_options; | |
ob_start(); ?> | |
<div class="wrap"> | |
<h2><?php _e('Basic info', 'basic'); ?></h2> | |
<form method="post" action="options.php"> | |
<?php settings_fields('basic_bs_settings_group'); ?> | |
<table class="widefat"> | |
<tr> | |
<td colspan="2" style="padding: 10px;"> | |
<strong><?php _e('Please enter the details of your store. They will be rendered on the page footer.', 'basic'); ?></strong> | |
</td> | |
</tr> | |
<tr> | |
<td><?php _e('Address', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_address_street]" name="basic_bs_settings[bt_address_street]" type="text" value="<?php echo $basic_bs_options['bt_address_street']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('City - Area', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_address_city]" name="basic_bs_settings[bt_address_city]" type="text" value="<?php echo $basic_bs_options['bt_address_city']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('Postal Code', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_address_tk]" name="basic_bs_settings[bt_address_tk]" type="text" value="<?php echo $basic_bs_options['bt_address_tk']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('Phone', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_address_phone]" name="basic_bs_settings[bt_address_phone]" type="text" value="<?php echo $basic_bs_options['bt_address_phone']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('Mobile', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_address_mobile]" name="basic_bs_settings[bt_address_mobile]" type="text" value="<?php echo $basic_bs_options['bt_address_mobile']; ?>"/></td> | |
</tr> | |
<tr> | |
<td colspan="2" style="padding: 10px;"> | |
<strong><?php _e('You can enter you social profiles links below', 'basic'); ?></strong> | |
</td> | |
</tr> | |
<tr> | |
<td><?php _e('Facebook Page', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_facebook_link]" name="basic_bs_settings[bt_facebook_link]" type="text" value="<?php echo $basic_bs_options['bt_facebook_link']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('Twitter Username', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_twitter_username]" name="basic_bs_settings[bt_twitter_username]" type="text" value="<?php echo $basic_bs_options['bt_twitter_username']; ?>"/></td> | |
</tr> | |
<tr> | |
<td><?php _e('Google+ Page', 'basic'); ?></td> | |
<td><input style="width: 100%" id="basic_bs_settings[bt_gplus_link]" name="basic_bs_settings[bt_gplus_link]" type="text" value="<?php echo $basic_bs_options['bt_gplus_link']; ?>"/></td> | |
</tr> | |
</table> | |
<p class="submit"> | |
<input type="submit" class="button-primary" value="<?php _e('Save', 'basic'); ?>" /> | |
</p> | |
</form> | |
</div> | |
<?php | |
echo ob_get_clean(); | |
} | |
function business_tools_footer() { | |
global $basic_bs_options; ?> | |
<p class="BusinessDetails"> | |
<?php | |
$address = $basic_bs_options['bt_address_street']; | |
if (!empty($address)){ echo '<i class="icon-envelope icon-white"></i> ' . $address . ', '; } | |
$city = $basic_bs_options['bt_address_city']; | |
$tk = $basic_bs_options['bt_address_tk']; | |
if (!empty($city)){ echo $city . ', '; } | |
if (!empty($tk)){ echo $tk . ', '; } | |
$phone = $basic_bs_options['bt_address_phone']; | |
$mobile = $basic_bs_options['bt_address_mobile']; | |
if (!empty($phone)){ _e(' Phone: ', 'basic'); echo $phone; } | |
if (!empty($mobile)){ _e(' Mobile: ', 'basic'); echo $mobile; } | |
?> | |
</p> | |
<?php | |
} | |
function business_tools_header() { | |
global $basic_bs_options; ?> | |
<div class="SocialLinks"> | |
<span class="facebook"> | |
<?php | |
$fb_url = $basic_bs_options['bt_facebook_link']; | |
if (!empty($fb_url)){ ?> | |
<a class="facebook" target="_blank" href="<?php echo $fb_url; ?>"></a> | |
<?php } ?> | |
</span> | |
<span class="twitter"> | |
<?php | |
$tw_url = $basic_bs_options['bt_twitter_username']; | |
if (!empty($tw_url)){ ?> | |
<a class="twitter" href="https://twitter.com/<?php echo $tw_url; ?>"></a> | |
<?php } ?> | |
</span> | |
<span class="gplus"> | |
<?php | |
$gp_url = $basic_bs_options['bt_gplus_link']; | |
if (!empty($gp_url)){ ?> | |
<a class="google" target="_blank" href="<?php echo $gp_url; ?>"></a> | |
<?php } ?> | |
</span> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment