Version Description
Download this release
Release Info
Developer | dgwyer |
Plugin | Simple Sitemap – Automatically Generate a Responsive Sitemap |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.54 to 1.6
- images/facebook.png +0 -0
- readme.txt +15 -16
- simple-sitemap.php +85 -176
images/facebook.png
DELETED
Binary file
|
readme.txt
CHANGED
@@ -3,20 +3,22 @@ Contributors: dgwyer
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UUFZZU35RZPW8
|
4 |
Tags: sitemap, html, global, sort, shortcode, pages, posts
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
|
14 |
|
15 |
This is probably the easiest way to add a powerful HTML sitemap to your site!
|
16 |
|
17 |
Unique and intuitive way to display your website content by simply adding a single shortcode [simple-sitemap] to a post, page, or sidebar (via a Text widget). See the Plugin screenshots for examples.
|
18 |
|
19 |
-
|
|
|
|
|
20 |
|
21 |
This gives your visitors an efficient way to view ALL site content in ONE place. It is also great for SEO purposes and makes it easier for spiders to index your site.
|
22 |
|
@@ -34,7 +36,7 @@ and for posts:
|
|
34 |
* Category
|
35 |
* Tag
|
36 |
|
37 |
-
To display the shortcode on a page, or post (though
|
38 |
|
39 |
Please rate this Plugin if you find it useful, thanks.
|
40 |
|
@@ -42,16 +44,7 @@ See our <a href="http://www.presscoders.com" target="_blank">WordPress developme
|
|
42 |
|
43 |
== Installation ==
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
1. Download and extract the Plugin zip file.
|
48 |
-
2. Upload the folder containing the Plugin files to your WordPress Plugins folder (usually ../wp-content/plugins/ folder).
|
49 |
-
3. Activate the Plugin via the 'Plugins' menu in WordPress.
|
50 |
-
4. Add [simple-sitemap] shortcode to a page to display the sitemap on your site.
|
51 |
-
|
52 |
-
The Plugin can also be installed directly from the main WordPress Plugin page.
|
53 |
-
|
54 |
-
1. Go to the Plugins => Add New page.
|
55 |
2. Enter 'Simple Sitemap' (without quotes) in the textbox and click the 'Search Plugins' button.
|
56 |
3. In the list of relevant Plugins click the 'Install' link for Simple Sitemap on the right hand side of the page.
|
57 |
4. Click the 'Install Now' button on the popup page.
|
@@ -67,7 +60,13 @@ The Plugin can also be installed directly from the main WordPress Plugin page.
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
-
*1.
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
* Security issue addressed.
|
73 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UUFZZU35RZPW8
|
4 |
Tags: sitemap, html, global, sort, shortcode, pages, posts
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 1.6
|
8 |
|
9 |
HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Update: From v1.6 Custom Post Types Supported!
|
14 |
|
15 |
This is probably the easiest way to add a powerful HTML sitemap to your site!
|
16 |
|
17 |
Unique and intuitive way to display your website content by simply adding a single shortcode [simple-sitemap] to a post, page, or sidebar (via a Text widget). See the Plugin screenshots for examples.
|
18 |
|
19 |
+
You can now also add the [simple-sitemap] shortcode to a Text widget too! Rendering of the sitemap is now one column so it fits nicely on posts, pages, or your sidebar.
|
20 |
+
|
21 |
+
The order and style in which your blog posts and pages are displayed on the screen depends on the dropdown option chosen in Plugin settings. Posts/pages are rendered as a single linked list of titles, or they can be grouped by date, author, category, and tag (each heading acts as a link the the relevant taxonomy type as well).
|
22 |
|
23 |
This gives your visitors an efficient way to view ALL site content in ONE place. It is also great for SEO purposes and makes it easier for spiders to index your site.
|
24 |
|
36 |
* Category
|
37 |
* Tag
|
38 |
|
39 |
+
To display the shortcode on a page, or post (though it's recommended you add it to a page) just add the shortcode [simple-sitemap]. Then, simply publish the page and you will now have a sitemap enabled on your website.
|
40 |
|
41 |
Please rate this Plugin if you find it useful, thanks.
|
42 |
|
44 |
|
45 |
== Installation ==
|
46 |
|
47 |
+
1. Via the WordPress admin go to Plugins => Add New.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
2. Enter 'Simple Sitemap' (without quotes) in the textbox and click the 'Search Plugins' button.
|
49 |
3. In the list of relevant Plugins click the 'Install' link for Simple Sitemap on the right hand side of the page.
|
50 |
4. Click the 'Install Now' button on the popup page.
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
*1.6*
|
64 |
+
|
65 |
+
* Links on Plugins page updated.
|
66 |
+
* Removed front end drop downs. Sitemap rendering now solely controlled via plugin settings.
|
67 |
+
* Support for Custom Post Types added!
|
68 |
+
|
69 |
+
*1.54*
|
70 |
|
71 |
* Security issue addressed.
|
72 |
|
simple-sitemap.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Simple Sitemap
|
4 |
Plugin URI: http://www.presscoders.com/plugins/free-plugins/simple-sitemap/
|
5 |
Description: HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
|
6 |
-
Version: 1.
|
7 |
Author: David Gwyer
|
8 |
Author URI: http://www.presscoders.com
|
9 |
*/
|
@@ -26,6 +26,8 @@ Author URI: http://www.presscoders.com
|
|
26 |
*/
|
27 |
|
28 |
/* @todo:
|
|
|
|
|
29 |
- Add option that if a page ID is excluded, it also excludes its children?
|
30 |
- Get rid of query_posts().
|
31 |
- Enable responsive wrapping so that if there is space multiple columns will span across the page and automatically wrap to the next line when not enough space.
|
@@ -33,7 +35,7 @@ Author URI: http://www.presscoders.com
|
|
33 |
- Be able to sort ascending/descending in addition to the sort drop down options for each list.
|
34 |
- Add all Plugin options page in-line styles to external style sheet.
|
35 |
- Options to display custom post types, with ability to show which custom post types to display or not display, and in what order?
|
36 |
-
- Consider adding a drop down in Plugin options to show the page hierarchy as it appears in 'Pages' (i.e. the way it works now), or to show it via a defined custom menu hierarchy.
|
37 |
- Add option to remove certain tags, categories, or posts.
|
38 |
- Use the 'prepare' WP feature when querying the db directly.
|
39 |
- Use translation functions _e(), __() etc. Add Plugin text domain too.
|
@@ -45,7 +47,6 @@ Author URI: http://www.presscoders.com
|
|
45 |
|
46 |
/* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
|
47 |
add_shortcode('simple-sitemap', 'wpss_gen');
|
48 |
-
add_filter('query_vars', 'wpss_parameter_queryvars' );
|
49 |
|
50 |
register_activation_hook(__FILE__, 'wpss_add_defaults');
|
51 |
register_uninstall_hook(__FILE__, 'wpss_delete_plugin_options');
|
@@ -53,10 +54,6 @@ add_action('admin_init', 'wpss_init' );
|
|
53 |
add_action('admin_menu', 'wpss_add_options_page');
|
54 |
add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
|
55 |
|
56 |
-
// ***************************************
|
57 |
-
// *** START - Create Admin Options ***
|
58 |
-
// ***************************************
|
59 |
-
|
60 |
/* Delete options table entries ONLY when plugin deactivated AND deleted. */
|
61 |
function wpss_delete_plugin_options() {
|
62 |
delete_option('wpss_options');
|
@@ -71,8 +68,8 @@ function wpss_add_defaults() {
|
|
71 |
$arr = array( "drp_pages_default" => "post_title",
|
72 |
"drp_posts_default" => "title",
|
73 |
"chk_default_options_db" => "0",
|
74 |
-
"chk_show_dropdowns" => "0",
|
75 |
"chk_show_pages" => "1",
|
|
|
76 |
"chk_show_posts" => "1",
|
77 |
"txt_page_ids" => ""
|
78 |
);
|
@@ -103,22 +100,12 @@ function wpss_add_options_page() {
|
|
103 |
add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form');
|
104 |
}
|
105 |
|
106 |
-
/* Record Plugin activation error messages. */
|
107 |
-
add_action( 'activated_plugin', 'wpss_save_error' );
|
108 |
-
function wpss_save_error(){
|
109 |
-
delete_option( 'pc_plugin_error' );
|
110 |
-
}
|
111 |
-
|
112 |
/* Draw the menu page itself. */
|
113 |
function wpss_render_form() {
|
114 |
?>
|
115 |
<div class="wrap">
|
116 |
<h2>Simple Sitemap Options</h2>
|
117 |
|
118 |
-
<div style="margin-top:15px;">
|
119 |
-
<p>Here's a little a bonus AVAILABLE ONLY to our free Plugin users! <a href="http://www.presscoders.com/designfolio-offer/" target="_blank"><strong>Get $20 OFF</strong></a> the price of our fully responsive, cutting edge <a href="http://www.presscoders.com/designfolio-offer/" target="_blank">Designfolio</a> theme.</p>
|
120 |
-
</div>
|
121 |
-
|
122 |
<div style="background:#eee;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b>[simple-sitemap]</b></div>
|
123 |
<form method="post" action="options.php">
|
124 |
<?php settings_fields('wpss_plugin_options'); ?>
|
@@ -151,14 +138,7 @@ function wpss_render_form() {
|
|
151 |
<tr>
|
152 |
<th scope="row">Exclude Pages</th>
|
153 |
<td>
|
154 |
-
<input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>" /><
|
155 |
-
</td>
|
156 |
-
</tr>
|
157 |
-
|
158 |
-
<tr>
|
159 |
-
<th scope="row">Sitemap Drop Down Boxes</th>
|
160 |
-
<td>
|
161 |
-
<label><input name="wpss_options[chk_show_dropdowns]" type="checkbox" value="1" <?php if (isset($options['chk_show_dropdowns'])) { checked('1', $options['chk_show_dropdowns']); } ?> /> Display drop down boxes on front end sitemap?</label>
|
162 |
</td>
|
163 |
</tr>
|
164 |
|
@@ -176,12 +156,17 @@ function wpss_render_form() {
|
|
176 |
</td>
|
177 |
</tr>
|
178 |
|
179 |
-
<tr
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
<tr valign="top" style="border-top:#dddddd 1px solid;">
|
182 |
<th scope="row">Database Options</th>
|
183 |
<td>
|
184 |
-
<label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_db'])) { checked('1', $options['chk_default_options_db']); } ?> /> Restore Plugin defaults upon deactivation/reactivation</label><
|
185 |
</td>
|
186 |
</tr>
|
187 |
</table>
|
@@ -190,168 +175,68 @@ function wpss_render_form() {
|
|
190 |
</p>
|
191 |
</form>
|
192 |
|
193 |
-
<
|
194 |
-
|
195 |
-
<p>
|
196 |
-
<a href="http://www.facebook.com/PressCoders" title="Our Facebook page" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/facebook.png" /></a><a href="http://www.twitter.com/dgwyer" title="Follow on Twitter" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter.png" /></a> <input class="button" style="vertical-align:12px;" type="button" value="Visit Our Site" onClick="window.open('http://www.presscoders.com')"> <input class="button" style="vertical-align:12px;" type="button" value="Free Responsive Theme!" onClick="window.open('http://www.presscoders.com/designfolio')">
|
197 |
-
</p>
|
198 |
-
</div>
|
199 |
-
|
200 |
</div>
|
201 |
<?php
|
202 |
}
|
203 |
|
204 |
-
/* Sanitize and validate input. Accepts an array, return a sanitized array. */
|
205 |
-
function wpss_validate_options($input) {
|
206 |
-
// Strip html from textboxes
|
207 |
-
// e.g. $input['textbox'] = wp_filter_nohtml_kses($input['textbox']);
|
208 |
-
|
209 |
-
$input['txt_page_ids'] = sanitize_text_field( $input['txt_page_ids'] );
|
210 |
-
|
211 |
-
return $input;
|
212 |
-
}
|
213 |
-
|
214 |
-
// ***************************************
|
215 |
-
// *** END - Create Admin Options ***
|
216 |
-
// ***************************************
|
217 |
-
|
218 |
-
// ---------------------------------------------------------------------------------
|
219 |
-
|
220 |
-
// ***************************************
|
221 |
-
// *** START - Plugin Core Functions ***
|
222 |
-
// ***************************************
|
223 |
-
|
224 |
-
function wpss_parameter_queryvars( $qvars ) {
|
225 |
-
$qvars[] = 'pagesort';
|
226 |
-
$qvars[] = 'postsort';
|
227 |
-
return $qvars;
|
228 |
-
}
|
229 |
-
|
230 |
-
function wpss_page_params() {
|
231 |
-
global $wp_query;
|
232 |
-
if (isset($wp_query->query_vars['pagesort'])) {
|
233 |
-
return $wp_query->query_vars['pagesort'];
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
function wpss_post_params() {
|
238 |
-
global $wp_query;
|
239 |
-
if (isset($wp_query->query_vars['postsort'])) {
|
240 |
-
return $wp_query->query_vars['postsort'];
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
/* Shortcode function. */
|
245 |
function wpss_gen() {
|
|
|
246 |
ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
$
|
253 |
}
|
254 |
-
else if(
|
255 |
-
$
|
256 |
-
$query_symbol = '?'; // add a '?' character prefix onto the query string
|
257 |
}
|
258 |
else {
|
259 |
-
$
|
260 |
-
$query_symbol = '?'; // add a '?' character prefix onto the query string
|
261 |
}
|
262 |
|
263 |
-
/* Sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages). */
|
264 |
-
$page_params = wpss_page_params();
|
265 |
-
$post_params = wpss_post_params();
|
266 |
-
|
267 |
-
$opt = get_option('wpss_options');
|
268 |
-
//echo '$opt[\'drp_pages_default\'] = '.$opt['drp_pages_default'].'<br />';
|
269 |
-
//echo '$opt[\'drp_posts_default\'] = '.$opt['drp_posts_default'].'<br />';
|
270 |
-
|
271 |
-
if($page_params == null ) {
|
272 |
-
if($opt['drp_pages_default'] == "post_title") { $page_params = 'menu_order, post_title'; }
|
273 |
-
else if ($opt['drp_pages_default'] == "post_date") { $page_params = 'post_date'; }
|
274 |
-
else { $page_params = 'post_author'; }
|
275 |
-
}
|
276 |
$page_args = array( 'sort_column' => $page_params, 'title_li' => '');
|
277 |
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
else if ($opt['drp_posts_default'] == "author") { $post_params = 'author'; }
|
283 |
-
else if ($opt['drp_posts_default'] == "category") { $post_params = 'category'; }
|
284 |
-
else { $post_params = 'tags'; }
|
285 |
}
|
286 |
-
|
287 |
-
|
288 |
-
//echo "<br />Page Args: <br />";
|
289 |
-
//print_r($page_args);
|
290 |
-
//echo "<br /><br />Posts Args: <br />";
|
291 |
-
//print_r($post_args);
|
292 |
-
//echo "<br /><br />Page Params: $page_params";
|
293 |
-
//echo "<br />Post Params: $post_params";
|
294 |
-
|
295 |
-
/* Initialise to "" to prevent undefined variable error. */
|
296 |
-
$pt1=$pd1=$pa1=$pt2=$pd2=$pa2=$pc2=$ptg2="";
|
297 |
-
|
298 |
-
/* Page drop down box. */
|
299 |
-
if($page_params == 'menu_order, post_title') {
|
300 |
-
$pt1 = "selected='selected'";
|
301 |
}
|
302 |
-
else if($
|
303 |
-
$
|
304 |
}
|
305 |
-
else if($
|
306 |
-
$
|
307 |
}
|
308 |
-
|
309 |
-
|
310 |
-
if($post_params == 'title') {
|
311 |
-
$pt2 = "selected='selected'";
|
312 |
-
}
|
313 |
-
else if($post_params == 'date') {
|
314 |
-
$pd2 = "selected='selected'";
|
315 |
-
}
|
316 |
-
else if($post_params == 'author') {
|
317 |
-
$pa2 = "selected='selected'";
|
318 |
-
}
|
319 |
-
else if($post_params == 'category') {
|
320 |
-
$pc2 = "selected='selected'";
|
321 |
-
}
|
322 |
-
else if($post_params == 'tags') {
|
323 |
-
$ptg2 = "selected='selected'";
|
324 |
}
|
325 |
|
|
|
|
|
326 |
?>
|
327 |
|
328 |
<div class="ss_wrapper">
|
329 |
|
|
|
|
|
330 |
<?php if(isset($opt['chk_show_pages']) && $opt['chk_show_pages']) : ?>
|
331 |
|
332 |
<div id="ss_pages">
|
333 |
|
334 |
<h2 class='page_heading'>Pages</h2>
|
335 |
|
336 |
-
<?php if(isset($opt['chk_show_dropdowns']) && $opt['chk_show_dropdowns']) : ?>
|
337 |
-
|
338 |
-
<div id="page_drop_down">
|
339 |
-
<form name="page_drop_form" id="page_drop_form">
|
340 |
-
<span id="page_dd_label">Show pages by:</span>
|
341 |
-
<select name="page_drop_select" OnChange="location.href=page_drop_form.page_drop_select.options[selectedIndex].value">
|
342 |
-
<option value="<?php echo $link_url.$query_symbol.'pagesort=post_title'; ?>" <?php echo $pt1; ?>>Title</option>
|
343 |
-
<option value="<?php echo $link_url.$query_symbol.'pagesort=post_date'; ?>" <?php echo $pd1; ?>>Date</option>
|
344 |
-
<option value="<?php echo $link_url.$query_symbol.'pagesort=post_author'; ?>" <?php echo $pa1; ?>>Author</option>
|
345 |
-
</select>
|
346 |
-
</form>
|
347 |
-
</div>
|
348 |
-
|
349 |
-
<?php endif; ?>
|
350 |
-
|
351 |
<?php
|
352 |
if(strpos($page_params, 'post_date') !== false) {
|
353 |
echo '<ul class="page_item_list">';
|
354 |
-
$page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', '
|
355 |
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
356 |
wp_list_pages($page_args); // show the sorted pages
|
357 |
echo '</ul>';
|
@@ -387,28 +272,14 @@ function wpss_gen() {
|
|
387 |
|
388 |
<?php endif; ?>
|
389 |
|
|
|
|
|
|
|
390 |
<?php if(isset($opt['chk_show_posts']) && $opt['chk_show_posts']) : ?>
|
391 |
|
392 |
<div id="ss_posts">
|
393 |
<h2 class='post_heading'>Posts</h2>
|
394 |
|
395 |
-
<?php if(isset($opt['chk_show_dropdowns']) && $opt['chk_show_dropdowns']) : ?>
|
396 |
-
|
397 |
-
<div id="post_drop_down">
|
398 |
-
<form name="post_drop_form" id="post_drop_form">
|
399 |
-
<span id="post_dd_label">Show posts by:</span>
|
400 |
-
<select name="post_drop_select" OnChange="location.href=post_drop_form.post_drop_select.options[selectedIndex].value">
|
401 |
-
<option value="<?php echo $link_url.$query_symbol.'postsort=title'; ?>" <?php echo $pt2; ?>>Title</option>
|
402 |
-
<option value="<?php echo $link_url.$query_symbol.'postsort=date'; ?>" <?php echo $pd2; ?>>Date</option>
|
403 |
-
<option value="<?php echo $link_url.$query_symbol.'postsort=author'; ?>" <?php echo $pa2; ?>>Author</option>
|
404 |
-
<option value="<?php echo $link_url.$query_symbol.'postsort=category'; ?>" <?php echo $pc2; ?>>Category</option>
|
405 |
-
<option value="<?php echo $link_url.$query_symbol.'postsort=tags'; ?>" <?php echo $ptg2; ?>>Tags</option>
|
406 |
-
</select>
|
407 |
-
</form>
|
408 |
-
</div>
|
409 |
-
|
410 |
-
<?php endif; ?>
|
411 |
-
|
412 |
<?php
|
413 |
if(strpos($post_params, 'category') !== false) {
|
414 |
$categories = get_categories();
|
@@ -534,6 +405,39 @@ function wpss_gen() {
|
|
534 |
|
535 |
<?php endif; ?>
|
536 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
</div>
|
538 |
<?php
|
539 |
|
@@ -556,7 +460,12 @@ function wpss_plugin_action_links( $links, $file ) {
|
|
556 |
return $links;
|
557 |
}
|
558 |
|
559 |
-
|
560 |
-
|
561 |
-
//
|
562 |
-
|
|
|
|
|
|
|
|
|
|
3 |
Plugin Name: Simple Sitemap
|
4 |
Plugin URI: http://www.presscoders.com/plugins/free-plugins/simple-sitemap/
|
5 |
Description: HTML sitemap to display content as a single linked list of posts and pages, or as groups sorted by taxonomy (via a drop-down box).
|
6 |
+
Version: 1.6
|
7 |
Author: David Gwyer
|
8 |
Author URI: http://www.presscoders.com
|
9 |
*/
|
26 |
*/
|
27 |
|
28 |
/* @todo:
|
29 |
+
- Redo Plugin screenshots.
|
30 |
+
- Add text box that allows you to enter a comma separated list of custom post type names to exclude from the front end sitemap. Maybe only show this text box if the checkbox to show cpt is selected. For convenience, show a current list of cpt names that can be excluded.
|
31 |
- Add option that if a page ID is excluded, it also excludes its children?
|
32 |
- Get rid of query_posts().
|
33 |
- Enable responsive wrapping so that if there is space multiple columns will span across the page and automatically wrap to the next line when not enough space.
|
35 |
- Be able to sort ascending/descending in addition to the sort drop down options for each list.
|
36 |
- Add all Plugin options page in-line styles to external style sheet.
|
37 |
- Options to display custom post types, with ability to show which custom post types to display or not display, and in what order?
|
38 |
+
- Consider adding a drop down in Plugin options to show the page hierarchy as it appears in 'Pages' (i.e. the way it works now), or to show it via a defined custom menu hierarchy in Appearance -> Menus.
|
39 |
- Add option to remove certain tags, categories, or posts.
|
40 |
- Use the 'prepare' WP feature when querying the db directly.
|
41 |
- Use translation functions _e(), __() etc. Add Plugin text domain too.
|
47 |
|
48 |
/* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
|
49 |
add_shortcode('simple-sitemap', 'wpss_gen');
|
|
|
50 |
|
51 |
register_activation_hook(__FILE__, 'wpss_add_defaults');
|
52 |
register_uninstall_hook(__FILE__, 'wpss_delete_plugin_options');
|
54 |
add_action('admin_menu', 'wpss_add_options_page');
|
55 |
add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
|
56 |
|
|
|
|
|
|
|
|
|
57 |
/* Delete options table entries ONLY when plugin deactivated AND deleted. */
|
58 |
function wpss_delete_plugin_options() {
|
59 |
delete_option('wpss_options');
|
68 |
$arr = array( "drp_pages_default" => "post_title",
|
69 |
"drp_posts_default" => "title",
|
70 |
"chk_default_options_db" => "0",
|
|
|
71 |
"chk_show_pages" => "1",
|
72 |
+
"chk_show_cpts" => "1",
|
73 |
"chk_show_posts" => "1",
|
74 |
"txt_page_ids" => ""
|
75 |
);
|
100 |
add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form');
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/* Draw the menu page itself. */
|
104 |
function wpss_render_form() {
|
105 |
?>
|
106 |
<div class="wrap">
|
107 |
<h2>Simple Sitemap Options</h2>
|
108 |
|
|
|
|
|
|
|
|
|
109 |
<div style="background:#eee;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b>[simple-sitemap]</b></div>
|
110 |
<form method="post" action="options.php">
|
111 |
<?php settings_fields('wpss_plugin_options'); ?>
|
138 |
<tr>
|
139 |
<th scope="row">Exclude Pages</th>
|
140 |
<td>
|
141 |
+
<input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>" /><p class="description">Enter a comma separated list of Page ID's.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
</td>
|
143 |
</tr>
|
144 |
|
156 |
</td>
|
157 |
</tr>
|
158 |
|
159 |
+
<tr>
|
160 |
+
<th scope="row">Show Custom Post Types</th>
|
161 |
+
<td>
|
162 |
+
<label><input name="wpss_options[chk_show_cpts]" type="checkbox" value="1" <?php if (isset($options['chk_show_cpts'])) { checked('1', $options['chk_show_cpts']); } ?> /> Display Custom Post Types on front end sitemap?</label>
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
|
166 |
<tr valign="top" style="border-top:#dddddd 1px solid;">
|
167 |
<th scope="row">Database Options</th>
|
168 |
<td>
|
169 |
+
<label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php if (isset($options['chk_default_options_db'])) { checked('1', $options['chk_default_options_db']); } ?> /> Restore Plugin defaults upon deactivation/reactivation</label><p class="description">Only check this if you want to reset plugin settings upon reactivation</p>
|
170 |
</td>
|
171 |
</tr>
|
172 |
</table>
|
175 |
</p>
|
176 |
</form>
|
177 |
|
178 |
+
<p>Note: This is a FREE Plugin. If you use it on your website <b>please</b> consider making a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UUFZZU35RZPW8" target="_blank">donation</a> to support continued development.</p>
|
179 |
+
<a href="http://www.twitter.com/dgwyer" title="Follow on Twitter" target="_blank"><img src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter.png" /></a> <input class="button" style="vertical-align:12px;" type="button" value="Visit Our Site" onClick="window.open('http://www.presscoders.com')"></p>
|
|
|
|
|
|
|
|
|
|
|
180 |
</div>
|
181 |
<?php
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
/* Shortcode function. */
|
185 |
function wpss_gen() {
|
186 |
+
|
187 |
ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
|
188 |
|
189 |
+
$opt = get_option('wpss_options');
|
190 |
+
|
191 |
+
// Page query args from Plugin options
|
192 |
+
if($opt['drp_pages_default'] == "post_title") {
|
193 |
+
$page_params = 'menu_order, post_title';
|
194 |
}
|
195 |
+
else if ($opt['drp_pages_default'] == "post_date") {
|
196 |
+
$page_params = 'post_date';
|
|
|
197 |
}
|
198 |
else {
|
199 |
+
$page_params = 'post_author';
|
|
|
200 |
}
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
$page_args = array( 'sort_column' => $page_params, 'title_li' => '');
|
203 |
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
204 |
|
205 |
+
// Post query args from Plugin options
|
206 |
+
if($opt['drp_posts_default'] == "title") {
|
207 |
+
$post_params = 'title';
|
|
|
|
|
|
|
208 |
}
|
209 |
+
else if ($opt['drp_posts_default'] == "date") {
|
210 |
+
$post_params = 'date';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
+
else if ($opt['drp_posts_default'] == "author") {
|
213 |
+
$post_params = 'author';
|
214 |
}
|
215 |
+
else if ($opt['drp_posts_default'] == "category") {
|
216 |
+
$post_params = 'category';
|
217 |
}
|
218 |
+
else {
|
219 |
+
$post_params = 'tags';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
|
222 |
+
$post_args = array( 'orderby' => $post_params, 'posts_per_page' => -1, 'order' => 'asc' );
|
223 |
+
|
224 |
?>
|
225 |
|
226 |
<div class="ss_wrapper">
|
227 |
|
228 |
+
<?php // RENDER SITEMAP PAGES ?>
|
229 |
+
|
230 |
<?php if(isset($opt['chk_show_pages']) && $opt['chk_show_pages']) : ?>
|
231 |
|
232 |
<div id="ss_pages">
|
233 |
|
234 |
<h2 class='page_heading'>Pages</h2>
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
<?php
|
237 |
if(strpos($page_params, 'post_date') !== false) {
|
238 |
echo '<ul class="page_item_list">';
|
239 |
+
$page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', 'title_li' => '');
|
240 |
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
241 |
wp_list_pages($page_args); // show the sorted pages
|
242 |
echo '</ul>';
|
272 |
|
273 |
<?php endif; ?>
|
274 |
|
275 |
+
|
276 |
+
<?php // RENDER SITEMAP POSTS ?>
|
277 |
+
|
278 |
<?php if(isset($opt['chk_show_posts']) && $opt['chk_show_posts']) : ?>
|
279 |
|
280 |
<div id="ss_posts">
|
281 |
<h2 class='post_heading'>Posts</h2>
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
<?php
|
284 |
if(strpos($post_params, 'category') !== false) {
|
285 |
$categories = get_categories();
|
405 |
|
406 |
<?php endif; ?>
|
407 |
|
408 |
+
|
409 |
+
<?php // RENDER SITEMAP CUSTOM POST TYPES ?>
|
410 |
+
|
411 |
+
<?php
|
412 |
+
$args = array( 'public' => true, '_builtin' => false );
|
413 |
+
$custom_post_types = get_post_types( $args, 'objects' );
|
414 |
+
|
415 |
+
foreach ( $custom_post_types as $post_type ) :
|
416 |
+
?>
|
417 |
+
|
418 |
+
<?php if(isset($opt['chk_show_cpts']) && $opt['chk_show_cpts']) : ?>
|
419 |
+
|
420 |
+
<div id="ss_cpt">
|
421 |
+
|
422 |
+
<h2 class='cpt_heading'><?php echo $post_type->label; ?></h2>
|
423 |
+
|
424 |
+
<?php
|
425 |
+
|
426 |
+
$cpt_posts = get_posts( 'post_type='.$post_type->name );
|
427 |
+
|
428 |
+
if( $cpt_posts ) : ?>
|
429 |
+
<ul class="cpt_item_list">
|
430 |
+
<?php foreach( $cpt_posts as $cpt_post ) : ?>
|
431 |
+
<li><a href="<?php echo $cpt_post->guid; ?>"> <?php echo $cpt_post->post_title; ?></a></li>
|
432 |
+
<?php endforeach; ?>
|
433 |
+
</ul>
|
434 |
+
<?php endif; ?>
|
435 |
+
</div><!--ss_cpt -->
|
436 |
+
|
437 |
+
<?php endif; ?>
|
438 |
+
|
439 |
+
<?php endforeach ?>
|
440 |
+
|
441 |
</div>
|
442 |
<?php
|
443 |
|
460 |
return $links;
|
461 |
}
|
462 |
|
463 |
+
/* Sanitize and validate input. Accepts an array, return a sanitized array. */
|
464 |
+
function wpss_validate_options($input) {
|
465 |
+
// Strip html from textboxes
|
466 |
+
// e.g. $input['textbox'] = wp_filter_nohtml_kses($input['textbox']);
|
467 |
+
|
468 |
+
$input['txt_page_ids'] = sanitize_text_field( $input['txt_page_ids'] );
|
469 |
+
|
470 |
+
return $input;
|
471 |
+
}
|