-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
133 lines (129 loc) · 5.12 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
$themename = "Masonry";
$shortname = "slidemag";
$settings_list = array(
'custom_logo_url',
'featured_text_title',
'sub_text_title',
'port_text_title',
'blog_text_title',
'contact_text_title',
'background_image_url',
'custom_background_color',
'disable_slideshow',
'facebook_link',
'twitter_link',
'picasa_link',
'google_plus_link',
'pinterest_link',
'vimeo_link',
'youtube_link',
'flickr_link',
'copyright_text',
'about_page',
'video_url_1',
'video_url_2',
'video_url_3'
);
function mytheme_add_admin() {
global $themename, $shortname, $settings_list;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
foreach($settings_list as $value) {
//echo '<script type="text/javascript">alert("' . $value . '");</script>';
//if($_REQUEST[$value] != "")
update_option($shortname . '_' . $value,$_REQUEST[$value]);
}
header("Location: themes.php?page=settings.php&saved=true");
die;
}
}
add_theme_page($themename." Settings", $themename." Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $settings_list;
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
?>
<style type="text/css">
table { border: none; }
td { padding: 5px; }
.ss_text { width: 350px; }
</style>
<div class="wrap">
<h2><?php echo $themename; ?> Theme Options</h2>
<form method="post">
<table>
<tr>
<td>Custom logo URL:</td>
<td><input type="text" name="custom_logo_url" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_custom_logo_url',''))); ?>" /><br /><small><a href="<?php bloginfo('url'); ?>/wp-admin/media-new.php" target="_blank">Upload your logo</a> (example: 500px wide x 100px high)</small></td>
</tr>
<tr>
<td>Background Image URL:</td>
<td><input type="text" name="background_image_url" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_background_image_url',''))); ?>" /><br /><small><a href="<?php bloginfo('url'); ?>/wp-admin/media-new.php" target="_blank">Upload your image</a></small></td>
</tr>
<td>Custom background color:</td>
<td><input type="text" name="custom_background_color" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_custom_background_color',''))); ?>" /> <small>e.g.: #27292a</small></td>
</tr>
<!--
<tr>
<td>About Page:</td>
<td>
<select name="about_page">
<?php
$args = array(
'post_type' => 'page',
'posts_per_page' => -1
);
query_posts($args);
$x = 0;
while (have_posts()) : the_post(); ?>
<option value="<?php echo get_the_ID(); ?>" <?php if (get_option($shortname . '_about_page','') == get_the_ID()) { echo 'selected'; } ?>><?php the_title(); ?></option>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</select>
</td>
</tr>
-->
<tr>
<td>Facebook Link:</td>
<td><input type="text" name="facebook_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_facebook_link',''))); ?>" /></td>
</tr>
<tr>
<td>Twitter Link:</td>
<td><input type="text" name="twitter_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_twitter_link',''))); ?>" /></td>
</tr>
<tr>
<td>Instagram Link:</td>
<td><input type="text" name="picasa_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_picasa_link',''))); ?>" /></td>
</tr>
<tr>
<td>Google Plus Link:</td>
<td><input type="text" name="google_plus_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_google_plus_link',''))); ?>" /></td>
</tr>
<tr>
<td>Pinterest Link:</td>
<td><input type="text" name="pinterest_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_pinterest_link',''))); ?>" /></td>
</tr>
<tr>
<td>Vimeo Link:</td>
<td><input type="text" name="vimeo_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_vimeo_link',''))); ?>" /></td>
</tr>
<tr>
<td>Youtube Link:</td>
<td><input type="text" name="youtube_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_youtube_link',''))); ?>" /></td>
</tr>
<tr>
<td>Linkedin Link:</td>
<td><input type="text" name="flickr_link" class="ss_text" value="<?php echo stripslashes(stripslashes(get_option($shortname.'_flickr_link',''))); ?>" /></td>
</tr>
</table>
<p class="submit">
<input name="save" type="submit" value="Save changes" />
<input type="hidden" name="action" value="save" />
</p>
</form>
<?php
}
add_action('admin_menu', 'mytheme_add_admin');
?>