Genesis Simple Edits - Version 1.0

Version Description

  • Initial Release
Download this release

Release Info

Developer nathanrice
Plugin Icon 128x128 Genesis Simple Edits
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (3) hide show
  1. js/admin.js +18 -0
  2. plugin.php +252 -0
  3. readme.txt +41 -0
js/admin.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+
3
+ $('.post-shortcodes').hide();
4
+ $('.footer-shortcodes').hide();
5
+
6
+ // toggles the slickbox on clicking the noted link Â
7
+ $('a.post-shortcodes-toggle').click(function() {
8
+ $('.post-shortcodes').toggle();
9
+ return false;
10
+ });
11
+
12
+ // toggles the slickbox on clicking the noted link Â
13
+ $('a.footer-shortcodes-toggle').click(function() {
14
+ $('.footer-shortcodes').toggle();
15
+ return false;
16
+ });
17
+
18
+ });
plugin.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Genesis Simple Edits
4
+ Plugin URI: http://www.studiopress.com/plugins/genesis-simple-edits
5
+ Description: Genesis Simple Edits lets you edit the three most commonly modified areas in any Genesis theme: the post-info, the post-meta, and the footer area.
6
+ Version: 1.0
7
+ Author: Nathan Rice
8
+ Author URI: http://www.nathanrice.net/
9
+ */
10
+
11
+ class Genesis_Simple_Edits {
12
+
13
+ // Constructor
14
+ function __construct() {
15
+
16
+ register_activation_hook( __FILE__, array( &$this, 'activation_hook' ) );
17
+
18
+ define( 'GSE_SETTINGS_FIELD', 'gse-settings' );
19
+
20
+ add_action( 'admin_init', array( &$this, 'javascript' ) );
21
+ add_action( 'admin_init', array( &$this, 'reset' ) );
22
+ add_action( 'admin_init', array( &$this, 'register_settings' ) );
23
+ add_action( 'admin_menu', array( &$this, 'add_menu' ), 15 );
24
+ add_action( 'admin_notices', array( &$this, 'notices' ) );
25
+
26
+ add_filter( 'genesis_post_info', array( &$this, 'post_info_filter' ), 20 );
27
+ add_filter( 'genesis_post_meta', array( &$this, 'post_meta_filter' ), 20 );
28
+ add_filter( 'genesis_footer_backtotop_text', array( &$this, 'footer_backtotop_filter' ), 20 );
29
+ add_filter( 'genesis_footer_creds_text', array( &$this, 'footer_creds_filter' ), 20 );
30
+ add_filter( 'genesis_footer_output', array( &$this, 'footer_output_filter' ), 20 );
31
+
32
+ }
33
+
34
+ // PHP4 Constructor
35
+ function Genesis_Simple_Edits() {
36
+ $this->__construct();
37
+ }
38
+
39
+ function activation_hook() {
40
+
41
+ $latest = '1.3';
42
+
43
+ $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
44
+
45
+ if( basename(TEMPLATEPATH) != 'genesis' ) {
46
+ deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
47
+ wp_die('Sorry, you can\'t activate unless you have installed <a href="http://www.studiopress.com/themes/genesis">Genesis</a>');
48
+ }
49
+
50
+ if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
51
+ deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
52
+ wp_die('Sorry, you can\'t activate without <a href="http://www.studiopress.com/support/showthread.php?t=19576">Genesis '.$latest.'</a> or greater');
53
+ }
54
+
55
+ }
56
+
57
+ function javascript() {
58
+
59
+ wp_enqueue_script( 'genesis-simple-edits-js', plugin_dir_url(__FILE__) . 'js/admin.js', array('jquery'), '', true );
60
+
61
+ }
62
+
63
+ function register_settings() {
64
+ register_setting( GSE_SETTINGS_FIELD, GSE_SETTINGS_FIELD );
65
+ add_option( GSE_SETTINGS_FIELD, $this->settings_defaults() );
66
+ }
67
+
68
+ function reset() {
69
+
70
+ if ( !isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis-simple-edits' )
71
+ return;
72
+
73
+ if ( genesis_get_option('reset', GSE_SETTINGS_FIELD) ) {
74
+ update_option( GSE_SETTINGS_FIELD, $this->settings_defaults() );
75
+ wp_redirect( admin_url( 'admin.php?page=genesis-simple-edits&reset=true' ) );
76
+ exit;
77
+ }
78
+
79
+ }
80
+
81
+ function notices() {
82
+
83
+ if ( !isset($_REQUEST['page']) || $_REQUEST['page'] != 'genesis-simple-edits' )
84
+ return;
85
+
86
+ if ( isset( $_REQUEST['reset'] ) && $_REQUEST['reset'] == 'true' ) {
87
+ echo '<div id="message" class="updated"><p><strong>'.__('Simple Edits Reset', 'gse').'</strong></p></div>';
88
+ }
89
+ elseif ( isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true') {
90
+ echo '<div id="message" class="updated"><p><strong>'.__('Simple Edits Saved', 'gse').'</strong></p></div>';
91
+ }
92
+
93
+ }
94
+
95
+ function settings_defaults() {
96
+
97
+ return array(
98
+ 'post_info' => '[post_date] ' . __('By', 'genesis') . ' [post_author_posts_link] [post_comments] [post_edit]',
99
+ 'post_meta' => '[post_categories] [post_tags]',
100
+ 'footer_backtotop_text' => '[footer_backtotop]',
101
+ 'footer_creds_text' => __('Copyright', 'genesis') . ' [footer_copyright] [footer_childtheme_link] &middot; [footer_genesis_link] [footer_studiopress_link] &middot; [footer_wordpress_link] &middot; [footer_loginout]',
102
+ 'footer_output_on' => 0,
103
+ 'footer_output' => '<div class="gototop"><p>[footer_backtotop]</p></div><div class="creds"><p>' . __('Copyright', 'genesis') . ' [footer_copyright] [footer_childtheme_link] &middot; [footer_genesis_link] [footer_studiopress_link] &middot; [footer_wordpress_link] &middot; [footer_loginout]</p></div>'
104
+ );
105
+
106
+ }
107
+
108
+ function add_menu() {
109
+ add_submenu_page('genesis', __('Simple Edits','gse'), __('Simple Edits','gse'), 'manage_options', 'genesis-simple-edits', array( &$this, 'admin_page' ) );
110
+ }
111
+
112
+ function admin_page() { ?>
113
+
114
+ <div class="wrap">
115
+ <form method="post" action="options.php">
116
+ <?php settings_fields(GSE_SETTINGS_FIELD); // important! ?>
117
+
118
+ <?php screen_icon('options-general'); ?>
119
+ <h2><?php _e('Genesis Simple Edits', 'gse'); ?></h2>
120
+
121
+ <table class="form-table"><tbody>
122
+
123
+ <tr>
124
+ <th scope="row"><p><label for="<?php echo GSE_SETTINGS_FIELD; ?>[post_info]"><b><?php _e('Post Info', 'genesis'); ?></b></label></p></th>
125
+ <td>
126
+ <p><input type="text" name="<?php echo GSE_SETTINGS_FIELD; ?>[post_info]" id="<?php echo GSE_SETTINGS_FIELD; ?>[post_info]" value="<?php echo esc_attr( genesis_get_option('post_info', GSE_SETTINGS_FIELD) ); ?>" size="125" /></p>
127
+ </td>
128
+ </tr>
129
+
130
+ <tr>
131
+ <th scope="row"><p><label for="<?php echo GSE_SETTINGS_FIELD; ?>[post_meta]"><b><?php _e('Post Meta', 'genesis'); ?></b></label></p></th>
132
+ <td>
133
+ <p><input type="text" name="<?php echo GSE_SETTINGS_FIELD; ?>[post_meta]" id="<?php echo GSE_SETTINGS_FIELD; ?>[post_meta]" value="<?php echo esc_attr( genesis_get_option('post_meta', GSE_SETTINGS_FIELD) ); ?>" size="125" /></p>
134
+
135
+ <p><small><a class="post-shortcodes-toggle" href="#">Show Available Post Info/Meta Shortcodes</a></small></p>
136
+
137
+ </td>
138
+ </tr>
139
+
140
+ <tr class="post-shortcodes" style="display: none;">
141
+ <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
142
+ <td>
143
+ <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://dev.studiopress.com/shortcode-reference" target="_blank">see this page</a>.') ?>
144
+ <p>
145
+ <ul>
146
+ <li>[post_date] - <span class="description"><?php _e('Date the post was published', ''); ?></span></li>
147
+ <li>[post_time] - <span class="description"><?php _e('Time the post was published', ''); ?></span></li>
148
+ <li>[post_author] - <span class="description"><?php _e('Post author display name', ''); ?></span></li>
149
+ <li>[post_author_link] - <span class="description"><?php _e('Post author display name, linked to their website', ''); ?></span></li>
150
+ <li>[post_author_posts_link] - <span class="description"><?php _e('Post author display name, linked to their archive', ''); ?></span></li>
151
+ <li>[post_comments] - <span class="description"><?php _e('Post comments link', ''); ?></span></li>
152
+ <li>[post_tags] - <span class="description"><?php _e('List of post tags', ''); ?></span></li>
153
+ <li>[post_categories] - <span class="description"><?php _e('List of post categories', ''); ?></span></li>
154
+ <li>[post_edit] - <span class="description"><?php _e('Post edit link (visible to admins)', ''); ?></span></li>
155
+ </ul>
156
+ </p>
157
+ </td>
158
+ </tr>
159
+
160
+ <tr>
161
+ <th scope="row"><p><label for="<?php echo GSE_SETTINGS_FIELD; ?>[footer_backtotop_text]"><b><?php _e('Footer "Back to Top" Link', 'genesis'); ?></b></label></p></th>
162
+ <td>
163
+ <p><input type="text" name="<?php echo GSE_SETTINGS_FIELD; ?>[footer_backtotop_text]" id="<?php echo GSE_SETTINGS_FIELD; ?>[footer_backtotop_text]" value="<?php echo esc_attr( genesis_get_option('footer_backtotop_text', GSE_SETTINGS_FIELD) ); ?>" size="125" /></p>
164
+ </td>
165
+ </tr>
166
+
167
+ <tr>
168
+ <th scope="row"><p><label for="<?php echo GSE_SETTINGS_FIELD; ?>[footer_creds_text]"><b><?php _e('Footer Credits Text', 'genesis'); ?></b></label></p></th>
169
+ <td>
170
+ <p><input type="text" name="<?php echo GSE_SETTINGS_FIELD; ?>[footer_creds_text]" id="<?php echo GSE_SETTINGS_FIELD; ?>[footer_creds_text]" value="<?php echo esc_attr( genesis_get_option('footer_creds_text', GSE_SETTINGS_FIELD) ); ?>" size="125" /></p>
171
+ </td>
172
+ </tr>
173
+
174
+ <tr>
175
+ <th scope="row"><p><b><?php _e('Footer Output', 'gse'); ?></b></p></th>
176
+ <td>
177
+ <p><input type="checkbox" name="<?php echo GSE_SETTINGS_FIELD; ?>[footer_output_on]" id="<?php echo GSE_SETTINGS_FIELD; ?>[footer_output_on]" value="1" <?php checked( 1, genesis_get_option('footer_output_on', GSE_SETTINGS_FIELD) ); ?> /> <label for="<?php echo GSE_SETTINGS_FIELD; ?>[footer_output_on]"><?php _e('Modify Entire Footer Text (including markup)?', 'genesis'); ?></label></p>
178
+
179
+ <p><span class="description"><?php _e('NOTE: Checking this option will override any edits you may have done to the footer "Back to Top" link or Credits text above.'); ?></span></p>
180
+
181
+ <p><textarea name="<?php echo GSE_SETTINGS_FIELD; ?>[footer_output]" cols="80" rows="5"><?php echo esc_html( htmlspecialchars( genesis_get_option('footer_output', GSE_SETTINGS_FIELD) ) ); ?></textarea></p>
182
+
183
+ <p><small><a class="footer-shortcodes-toggle" href="#">Show Available Footer Shortcodes</a></small></p>
184
+ </td>
185
+ </tr>
186
+
187
+ <tr class="footer-shortcodes" style="display: none;">
188
+ <th scope="row"><p><span class="description"><?php _e('Shortcode Reference'); ?></span></p></th>
189
+ <td>
190
+ <p><span class="description"><?php _e('NOTE: For a more comprehensive shortcode usage guide, <a href="http://dev.studiopress.com/shortcode-reference" target="_blank">see this page</a>.') ?>
191
+ <p>
192
+ <ul>
193
+ <li>[footer_backtotop] - <span class="description"><?php _e('The "Back to Top" Link', ''); ?></span></li>
194
+ <li>[footer_copyright] - <span class="description"><?php _e('The Copyright notice', ''); ?></span></li>
195
+ <li>[footer_childtheme_link] - <span class="description"><?php _e('The Child Theme Link', ''); ?></span></li>
196
+ <li>[footer_genesis_link] - <span class="description"><?php _e('The Genesis Link', ''); ?></span></li>
197
+ <li>[footer_studiopress_link] - <span class="description"><?php _e('The StudioPress Link', ''); ?></span></li>
198
+ <li>[footer_wordpress_link] - <span class="description"><?php _e('The WordPress Link', ''); ?></span></li>
199
+ <li>[footer_loginout] - <span class="description"><?php _e('Log In/Out Link', ''); ?></span></li>
200
+ </ul>
201
+ </p>
202
+ </td>
203
+ </tr>
204
+
205
+ </tbody></table>
206
+
207
+ <div class="bottom-buttons">
208
+ <input type="submit" class="button-primary" value="<?php _e('Save Settings', 'genesis') ?>" />
209
+ <input type="submit" class="button-highlighted" name="<?php echo GSE_SETTINGS_FIELD; ?>[reset]" value="<?php _e('Reset Settings', 'genesis'); ?>" />
210
+ </div>
211
+
212
+ </form>
213
+ </div>
214
+
215
+ <?php }
216
+
217
+ function post_info_filter( $output ) {
218
+
219
+ return genesis_get_option( 'post_info', GSE_SETTINGS_FIELD );
220
+
221
+ }
222
+
223
+ function post_meta_filter( $output ) {
224
+
225
+ return genesis_get_option( 'post_meta', GSE_SETTINGS_FIELD );
226
+
227
+ }
228
+
229
+ function footer_backtotop_filter( $output ) {
230
+
231
+ return genesis_get_option( 'footer_backtotop_text', GSE_SETTINGS_FIELD );
232
+
233
+ }
234
+
235
+ function footer_creds_filter( $output ) {
236
+
237
+ return genesis_get_option( 'footer_creds_text', GSE_SETTINGS_FIELD );
238
+
239
+ }
240
+
241
+ function footer_output_filter( $output ) {
242
+
243
+ if ( genesis_get_option( 'footer_output_on', GSE_SETTINGS_FIELD ) )
244
+ return genesis_get_option( 'footer_output', GSE_SETTINGS_FIELD );
245
+
246
+ return $output;
247
+
248
+ }
249
+
250
+ }
251
+
252
+ $Genesis_Simple_Edits = new Genesis_Simple_Edits;
readme.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: nathanrice, studiopress
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
+ Tags: shortcodes, genesis, genesiswp, studiopress
5
+ Requires at least: 3.0
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.0
8
+
9
+ This plugin lets you edit the three most commonly modified areas in any Genesis theme: the post-info (byline), the post-meta, and the footer area.
10
+
11
+ == Description ==
12
+
13
+ This plugin creates a new Genesis settings page that allows you to modify the post-info (byline), post-meta, and footer area on any Genesis theme. Using text, shortcodes, and HTML in the textboxes provided in the admin screen, these three commonly modified areas are easily editable, without having to learn PHP or write functions, filters, or mess with hooks.
14
+
15
+ == Installation ==
16
+
17
+ 1. Upload the entire `genesis-simple-edits` folder to the `/wp-content/plugins/` directory
18
+ 1. DO NOT change the name of the `genesis-simple-edits` folder
19
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
20
+ 1. Navigate to `Genesis > Simple Edits`
21
+ 1. Edit the areas you would like to change, using text, HTML, and the provided shortcode references.
22
+ 1. Save the changes
23
+
24
+ == Frequently Asked Questions ==
25
+
26
+ = What are Shortcodes? =
27
+
28
+ Check out the [Shortcodes API](http://codex.wordpress.org/Shortcode_API) for an explanation, and our [Shortcode Reference](http://dev.studiopress.com/shortcode-reference) for a list of available Genesis-specific shortcodes.
29
+
30
+ = My PHP isn't working =
31
+
32
+ This plugin is not designed to work with PHP code.
33
+
34
+ = The plugin won't activate =
35
+
36
+ You must have Genesis (1.3+) or a Genesis child theme installed and activated on your site.
37
+
38
+ == Changelog ==
39
+
40
+ = 1.0 =
41
+ * Initial Release