Simple Sitemap – Automatically Generate a Responsive Sitemap - Version 1.20

Version Description

Download this release

Release Info

Developer dgwyer
Plugin Icon Simple Sitemap – Automatically Generate a Responsive Sitemap
Version 1.20
Comparing to
See all releases

Code changes from version 1.01 to 1.20

Files changed (7) hide show
  1. css/ss_style.css +108 -0
  2. readme.txt +42 -18
  3. screenshot-1.png +0 -0
  4. screenshot-3.png +0 -0
  5. screenshot-4.png +0 -0
  6. simple-sitemap.php +373 -70
  7. style.css +0 -71
css/ss_style.css ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .pagenav {
2
+ font-family:Georgia, "Times New Roman", Times, serif;`
3
+ /*font-size:14px;*/
4
+ font-style:italic;
5
+ list-style-type: none;
6
+ margin: 0px 0px 0px 10px;
7
+ }
8
+
9
+ /* ---------------- */
10
+ /* Sitemap Page CSS */
11
+ /* ---------------- */
12
+ #ss_pages {
13
+ width: 49%;
14
+ }
15
+
16
+ .page_author {
17
+ color: #111;
18
+ }
19
+
20
+ #content .page_heading {
21
+ margin: 0px 0px 7px 0px;
22
+ padding: 0px 0px 4px 0px;
23
+ font-size: 19px;
24
+ font-style: italic;
25
+ border-bottom:1px #ccc solid;
26
+ }
27
+
28
+ #page_dd_label {
29
+ margin-right:5px;
30
+ font-size: 0.95em;
31
+ }
32
+
33
+ /* ---------------- */
34
+ /* Sitemap Post CSS */
35
+ /* ---------------- */
36
+ #ss_posts {
37
+ width: 49%;
38
+ }
39
+
40
+ .sticky {
41
+ font-style: italic;
42
+ color: #999;
43
+ font-size: 0.7em;
44
+ }
45
+
46
+ #post_dd_label {
47
+ margin-right:5px;
48
+ font-size: 0.95em;
49
+ }
50
+
51
+ #post_item {
52
+ /*border: 0px red solid;*/
53
+ margin:0px 0px 0px 0px;
54
+ }
55
+
56
+ div.post_item_list ul {
57
+ margin-bottom:18px;
58
+ }
59
+
60
+ #content .post_heading {
61
+ margin: 0px 0px 7px 0px;
62
+ padding: 0px 0px 4px 0px;
63
+ font-size: 19px;
64
+ font-style: italic;
65
+ border-bottom:1px #ccc solid;
66
+ }
67
+
68
+ /* ------------------------- */
69
+ /* Common to Posts and Pages */
70
+ /* ------------------------- */
71
+ ul.page_item_list li, ul.post_item_list li {
72
+ font-size: 15px;
73
+ font-weight: normal;
74
+ font-style: normal;
75
+ line-height: 1.6em;
76
+ /*list-style-type: none;*/
77
+ }
78
+
79
+ div.post_item_list, div.page_author {
80
+ font-size: 16px;
81
+ }
82
+
83
+ #page_drop_down, #post_drop_down {
84
+ margin: 14px 0px 0px 0px;
85
+ }
86
+
87
+ #ss_content_sep {
88
+ float: left;
89
+ width: 2%;
90
+ background-color: green;
91
+ }
92
+
93
+ .ss_wrapper {
94
+ margin: 10px 0px 0px 0px;
95
+ }
96
+
97
+ .ss_cat_header a, .ss_author_header a, ss_tag_header a, ss_date_header a, ss_page_date a {
98
+ font-size: 17px;
99
+ font-style:italic;
100
+ margin: 1px 2px 3px 4px;
101
+ }
102
+
103
+ #post_item, .page_item {
104
+ font-size: 15px;
105
+ font-weight: normal;
106
+ font-style: normal;
107
+ /*list-style-type: none;*/
108
+ }
readme.txt CHANGED
@@ -1,30 +1,42 @@
1
  === Simple Sitemap ===
2
  Contributors: dgwyer
 
3
  Tags: sitemap, html, global, sort, shortcode, pages, posts
4
  Requires at least: 2.7
5
- Tested up to: 3.0
6
- Stable tag: 1.01
7
 
8
- HTML Sitemap that displays an ordered list of posts and pages. Each list can be sorted via a drop down list of options.
9
 
10
  == Description ==
11
 
12
- Easiest way to add a HTML sitemap of posts and pages to your site!
13
 
14
- This gives your visitors an efficient way to view all of your available content (posts/pages) in one place. It is also good for SEO purposes and makes it easier for spiders to index your content. The sitemap generates two ordered lists, one for posts, and one for pages. Each list can be sorted individually via a drop down list of options.
15
 
16
- Available sorting options are:
 
 
 
 
 
 
17
 
18
  * Title
 
19
  * Author
 
 
 
 
20
  * Date
21
- * Post/Page ID
22
- * Date modified
23
- * Post/Page Order
24
 
25
- To display the shortcode on a page, or post (though I recommended you add it to a page) just add the shortcode [simple-sitemap] and you will now have a sitemap enabled on your website.
26
 
27
- Please rate this plugin if you find it useful, thanks.
28
 
29
  See our <a href="http://www.presscoders.com" target="_blank">WordPress development site</a> for more information.
30
 
@@ -37,22 +49,34 @@ Instructions for installing Simple Sitemap Plugin.
37
  3. Activate the Plugin via the 'Plugins' menu in WordPress.
38
  4. Add [simple-sitemap] shortcode to a page to display the sitemap on your site.
39
 
40
- The plugin can also be installed directly from the main WordPress plugin page.
41
 
42
  1. Go to the Plugins => Add New page.
43
  2. Enter 'Simple Sitemap' (without quotes) in the textbox and click the 'Search Plugins' button.
44
- 3. In the list of relevant plugins click the 'Install' link for Simple Sitemap on the right hand side of the page.
45
  4. Click the 'Install Now' button on the popup page.
46
  5. Click 'Activate Plugin' to finish installation.
47
  6. Add [simple-sitemap] shortcode to a page to display the sitemap on your site.
48
 
49
- Enjoy!
50
-
51
  == Screenshots ==
52
 
53
- 1. Simple Sitemap by default displays pages and posts side-by-side.
54
- 2. Just activate the plugin and add [simple-sitemap] shortcode to a page to display the sitemap.
 
 
55
 
56
  == Changelog ==
57
 
58
- *1.0 Initial release
 
 
 
 
 
 
 
 
 
 
 
 
1
  === Simple Sitemap ===
2
  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.0.1
7
+ Stable tag: 1.20
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: Plugin has just undergone a major overhaul, as of 02/09/2010!
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 page. See the Plugin screenshots for examples.
18
+
19
+ The order and style in which your blog posts and pages are displayed on the screen depends on the drop-down box option chosen. Post/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).
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
+
23
+ Available sorting options for pages are:
24
 
25
  * Title
26
+ * Date
27
  * Author
28
+
29
+ and for posts:
30
+
31
+ * Title
32
  * Date
33
+ * Author
34
+ * Category
35
+ * Tag
36
 
37
+ To display the shortcode on a page, or post (though I 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.
38
 
39
+ Please rate this Plugin if you find it useful, thanks.
40
 
41
  See our <a href="http://www.presscoders.com" target="_blank">WordPress development site</a> for more information.
42
 
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.
58
  5. Click 'Activate Plugin' to finish installation.
59
  6. Add [simple-sitemap] shortcode to a page to display the sitemap on your site.
60
 
 
 
61
  == Screenshots ==
62
 
63
+ 1. Simple Sitemap displays a list of pages and posts side-by-side. Sort options via drop-down box.
64
+ 2. Just activate the Plugin and add [simple-sitemap] shortcode to a page to display the sitemap.
65
+ 3. Plugin admin options allow you to swap pages/posts display order, and choose which drop-down options get selected by default.
66
+ 4. Shows the results of changing Plugin admin options to swap posts/page display order.
67
 
68
  == Changelog ==
69
 
70
+ *1.0 Initial release*
71
+
72
+ *1.01 Minor amendments*
73
+
74
+ *1.10 Fixed so that default permalink settings work fine on drop-down filter*
75
+
76
+ *1.20*
77
+
78
+ * Added Plugin admin options page
79
+ * Fixed several small bugs
80
+ * Sitemap layout tweaked and generally improved
81
+ * Added new rendering of sitemap depending on drop-down options
82
+ * New options to sort by category, author, tags, and date improved significantly
screenshot-1.png CHANGED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file
simple-sitemap.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Simple Sitemap
4
  Plugin URI: http://www.presscoders.com/plugins/free-plugins/simple-sitemap/
5
- Description: HTML Sitemap that displays an ordered list of posts and pages. Each list can be sorted via a drop down list of options.
6
- Version: 1.01
7
  Author: David Gwyer
8
  Author URI: http://www.presscoders.com
9
  */
@@ -25,31 +25,156 @@ Author URI: http://www.presscoders.com
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
- // To Do:
29
- //
30
- // 1. Have options in admin CP to: show posts/page/both; show post/page ID.
31
- // 2. Be able to expand collapse each individual tree of posts/pages (plus a collapse/expand all).
32
- // 3. Option to show 'Pages', 'Posts' header text.
33
- // 4. Have option to show the date etc. (as users may want to sort by date, and see date etc.)
34
- // 5. Have option to show Page/Post sitemaps side by side (default) or underneath each other (for users with long titles)
35
- // 6. Be able to sort ascending/descending in addition to the sort drop down options for each list.
36
- // 7. Be able to exclude individual posts/pages.
37
- // 8. Think about adding Categories, tags to the sitemap too.
38
 
39
  // wpss_ suffix is derived from [W]ord[P]ress [s]imple [s]itemap
40
  add_shortcode('simple-sitemap', 'wpss_gen');
41
- add_action('init', 'wpss_init' );
42
  add_filter('query_vars', 'parameter_queryvars' );
43
  //add_action( 'plugins_loaded', 'wpss_generate' );
44
  add_action('wp_print_styles', 'add_my_stylesheet');
45
 
 
 
 
 
 
46
  // ***************************************
47
  // *** START - Create Admin Options ***
48
  // ***************************************
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  // Init plugin options to white list our options
51
  function wpss_init(){
52
- // insert plugin init code here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  // ***************************************
@@ -63,7 +188,7 @@ function wpss_init(){
63
  // ***************************************
64
 
65
  function add_my_stylesheet() {
66
- $styleSheet = WP_PLUGIN_URL.'/simple-sitemap/style.css';
67
  wp_register_style('myStyleSheets', $styleSheet);
68
  wp_enqueue_style( 'myStyleSheets');
69
  }
@@ -90,42 +215,64 @@ function post_params() {
90
 
91
  // shortcode function
92
  function wpss_gen() {
 
 
93
  global $post; //wordpress post global object
94
  $permalink_structure = get_option( 'permalink_structure' );
95
- if(($permalink_structure == null) || (substr($permalink_structure, -1)) != '/') {
 
 
 
 
96
  $link_url = get_permalink($post->ID).'/';
 
97
  }
98
  else {
99
  $link_url = get_permalink($post->ID);
 
100
  }
101
-
102
  // sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages)
103
  $page_params = page_params();
104
  $post_params = post_params();
105
 
106
- if($page_params == null ) { $page_params = 'menu_order, post_title'; } // set default
107
- $page_args=array( 'sort_column' => $page_params,
108
- 'title_li' => '<h2 class=\'page_heading\'>Pages</h2>'
109
- );
110
- if($post_params == null ) { $post_params = 'title'; } // set default
111
- $post_args=array( 'orderby' => $post_params, 'posts_per_page' => -1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  // page drop down box
114
- if($page_params == 'post_title') {
115
  $pt1 = "selected='selected'";
116
  }
117
  else if($page_params == 'post_date') {
118
  $pd1 = "selected='selected'";
119
  }
120
- else if($page_params == 'menu_order') {
121
- $mo1 = "selected='selected'";
122
- }
123
- else if($page_params == 'post_modified') {
124
- $pm1 = "selected='selected'";
125
- }
126
- else if($page_params == 'ID') {
127
- $id1 = "selected='selected'";
128
- }
129
  else if($page_params == 'post_author') {
130
  $pa1 = "selected='selected'";
131
  }
@@ -137,65 +284,221 @@ function wpss_gen() {
137
  else if($post_params == 'date') {
138
  $pd2 = "selected='selected'";
139
  }
140
- else if($post_params == 'menu_order') {
141
- $mo2 = "selected='selected'";
142
- }
143
- else if($post_params == 'modified') {
144
- $pm2 = "selected='selected'";
145
- }
146
- else if($post_params == 'ID') {
147
- $id2 = "selected='selected'";
148
- }
149
  else if($post_params == 'author') {
150
  $pa2 = "selected='selected'";
151
  }
 
 
 
 
 
 
152
  ?>
153
- <table id="tbl_output">
154
- <tr>
155
- <td id="td_left">
 
 
 
 
 
 
 
 
 
 
156
  <div id="page_drop_down">
157
- <span id="page_dd_label">Sort Pages by:</span>
158
  <select>
159
- <option onClick="location.href='<?php echo $link_url.'?pagesort=post_title'; ?>'" <?php echo $pt1; ?>>Title</option>
160
- <option onClick="location.href='<?php echo $link_url.'?pagesort=post_date'; ?>'" <?php echo $pd1; ?>>Date</option>
161
- <option onClick="location.href='<?php echo $link_url.'?pagesort=menu_order'; ?>'" <?php echo $mo1; ?>>Page Order</option>
162
- <option onClick="location.href='<?php echo $link_url.'?pagesort=post_modified'; ?>'" <?php echo $pm1; ?>>Last Modified</option>
163
- <option onClick="location.href='<?php echo $link_url.'?pagesort=ID'; ?>'" <?php echo $id1; ?>>Page ID</option>
164
- <option onClick="location.href='<?php echo $link_url.'?pagesort=post_author'; ?>'" <?php echo $pa1; ?>>Author</option>
165
  </select>
166
  </div>
167
- <?php wp_list_pages($page_args); // show the sorted pages ?>
168
- <!--page_sitemap-->
169
- </td>
170
- <td id="td_right">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  <div id="post_drop_down">
172
- <span id="post_dd_label">Sort Posts by:</span>
173
  <select>
174
- <option onClick="location.href='<?php echo $link_url.'?postsort=title'; ?>'" <?php echo $pt2; ?>>Title</option>
175
- <option onClick="location.href='<?php echo $link_url.'?postsort=date'; ?>'" <?php echo $pd2; ?>>Date</option>
176
- <option onClick="location.href='<?php echo $link_url.'?postsort=menu_order'; ?>'" <?php echo $mo2; ?>>Post Order</option>
177
- <option onClick="location.href='<?php echo $link_url.'?postsort=modified'; ?>'" <?php echo $pm2; ?>>Last Modified</option>
178
- <option onClick="location.href='<?php echo $link_url.'?postsort=ID'; ?>'" <?php echo $id2; ?>>Post ID</option>
179
- <option onClick="location.href='<?php echo $link_url.'?postsort=author'; ?>'" <?php echo $pa2; ?>>Author</option>
180
  </select>
181
  </div>
182
- <?php query_posts($post_args); // show the sorted posts ?>
183
- <h2 class='post_heading'>Posts</h2>
184
- <?php if (have_posts()) :
 
 
 
 
 
 
 
 
 
 
 
 
185
  while (have_posts()) :
186
  the_post(); ?>
187
  <li id="post_item">
188
  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
189
  </li>
190
  <?php endwhile;
 
191
  endif;
192
  wp_reset_query();
193
- ?>
194
- </td>
195
- </tr>
196
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <?php
 
 
 
 
 
 
199
  }
200
  // ***************************************
201
  // *** END - Plugin Core Functions ***
2
  /*
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.20
7
  Author: David Gwyer
8
  Author URI: http://www.presscoders.com
9
  */
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
+ /* To Do:
29
+ 1. Be able to sort ascending/descending in addition to the sort drop down options for each list.
30
+ 2. Be able to exclude individual posts/pages.
31
+ 3. Have styling (in Plugins options page textarea?) to control sitemap rendering.
32
+ */
 
 
 
 
 
33
 
34
  // wpss_ suffix is derived from [W]ord[P]ress [s]imple [s]itemap
35
  add_shortcode('simple-sitemap', 'wpss_gen');
 
36
  add_filter('query_vars', 'parameter_queryvars' );
37
  //add_action( 'plugins_loaded', 'wpss_generate' );
38
  add_action('wp_print_styles', 'add_my_stylesheet');
39
 
40
+ register_activation_hook(__FILE__, 'wpss_add_defaults');
41
+ register_uninstall_hook(__FILE__, 'wpss_delete_plugin_options');
42
+ add_action('admin_init', 'wpss_init' );
43
+ add_action('admin_menu', 'wpss_add_options_page');
44
+
45
  // ***************************************
46
  // *** START - Create Admin Options ***
47
  // ***************************************
48
 
49
+ // delete options table entries ONLY when plugin deactivated AND deleted
50
+ function wpss_delete_plugin_options() {
51
+ delete_option('wpss_options');
52
+ }
53
+
54
+ // Define default option settings
55
+ function wpss_add_defaults() {
56
+ $tmp = get_option('wpss_options');
57
+ if(($tmp['chk_default_options_db']=='1')||(!is_array($tmp))) {
58
+ delete_option('wpss_options'); // so we don't have to reset all the 'off' checkboxes too! (don't think this is needed but leave for now)
59
+ $arr = array("drp_pages_default" => "post_title", "drp_posts_default" => "title", "chk_default_options_db" => "0", "rdo_display_order" => "pages_left");
60
+ update_option('wpss_options', $arr);
61
+ }
62
+ }
63
+
64
  // Init plugin options to white list our options
65
  function wpss_init(){
66
+ // this is primarily to check newly added options have correct initial values
67
+ $tmp = get_option('wpss_options');
68
+ if(!$tmp['rdo_display_order']) // check radio buttons have a starting value
69
+ {
70
+ $tmp["rdo_display_order"] = "pages_left";
71
+ update_option('wpss_options', $tmp);
72
+ }
73
+ register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' );
74
+ }
75
+
76
+ // Add menu page
77
+ function wpss_add_options_page() {
78
+ add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form');
79
+ }
80
+
81
+ // Draw the menu page itself
82
+ function wpss_render_form() {
83
+ ?>
84
+ <div class="wrap">
85
+ <div class="icon32" id="icon-options-general"><br></div>
86
+ <h2>Simple Sitemap Options</h2>
87
+ <div style="margin-top:20px;width:800px;">
88
+ <div style="float:left;width:80%;">Configure the plugin options below. If you like this Plugin, or use it on a commercial website, then <b><em>please</em></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 of this Plugin.</div>
89
+ <div style="float:right;width:20%;"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
90
+ <input type="hidden" name="cmd" value="_s-xclick">
91
+ <input type="hidden" name="hosted_button_id" value="UUFZZU35RZPW8">
92
+ <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
93
+ <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
94
+ </form>
95
+ </div>
96
+ </div>
97
+ <form method="post" action="options.php">
98
+ <?php settings_fields('wpss_plugin_options'); ?>
99
+ <?php $options = get_option('wpss_options'); ?>
100
+ <table class="form-table">
101
+ <tr valign="top">
102
+ <th scope="row">Content Display Order</th>
103
+ <td>
104
+ <label><input name="wpss_options[rdo_display_order]" type="radio" value="posts_left" <?php checked('posts_left', $options['rdo_display_order']); ?> /> Display <u>Posts</u> on LHS&nbsp;&nbsp;<small style="color: #999;">(with pages on the RHS)</small></label><br />
105
+ <label><input name="wpss_options[rdo_display_order]" type="radio" value="pages_left" <?php checked('pages_left', $options['rdo_display_order']); ?> /> Display <u>Pages</u> on LHS&nbsp;&nbsp;<small style="color: #999;">(with posts on the RHS)</small></label><br />
106
+ </td>
107
+ </tr>
108
+ <tr>
109
+ <th scope="row">Pages Drop-Down Default</th>
110
+ <td>
111
+ <select style="width:90px;" name='wpss_options[drp_pages_default]'>
112
+ <option value='post_title' <?php selected('post_title', $options['drp_pages_default']); ?>>Title</option>
113
+ <option value='post_date' <?php selected('post_date', $options['drp_pages_default']); ?>>Date</option>
114
+ <option value='post_author' <?php selected('post_author', $options['drp_pages_default']); ?>>Author</option>
115
+ </select>
116
+ </td>
117
+ </tr>
118
+ <tr>
119
+ <th scope="row">Posts Drop-Down Default</th>
120
+ <td>
121
+ <select style="width:90px;" name='wpss_options[drp_posts_default]'>
122
+ <option value='title' <?php selected('title', $options['drp_posts_default']); ?>>Title</option>
123
+ <option value='date' <?php selected('date', $options['drp_posts_default']); ?>>Date</option>
124
+ <option value='author' <?php selected('author', $options['drp_posts_default']); ?>>Author</option>
125
+ <option value='category' <?php selected('category', $options['drp_posts_default']); ?>>Category</option>
126
+ <option value='tags' <?php selected('tags', $options['drp_posts_default']); ?>>Tags</option>
127
+ </select>
128
+ </td>
129
+ </tr>
130
+ <tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
131
+ <tr valign="top" style="border-top:#dddddd 1px solid;">
132
+ <th scope="row">Database Options</th>
133
+ <td>
134
+ <label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php checked('1', $options['chk_default_options_db']); ?> /> Restore Plugin defaults upon deactivation/reactivation</label>
135
+ <br /><span style="color:#666666;margin-left:2px;">Only check this if you want to reset plugin settings upon reactivation</span>
136
+ </td>
137
+ </tr>
138
+ </table>
139
+ <p class="submit">
140
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
141
+ </p>
142
+ </form>
143
+
144
+ <div><strong>*New* Plugin Support Forum!</strong><a id="pc_support_toggle" href="#" title="status" style="margin-left:5px;"><small>(click to expand)</small></a></div>
145
+ <div id="pc_support" style="display:none;background:#eeeeee;border:1px solid #bbbbbb;margin-top:10px;padding:15px;">
146
+ <h3 style="margin:0px 0px 15px 0px;padding:0px;">Please help support the development of this plugin.</h3>
147
+
148
+ <div style="margin-bottom:10px;">Would you like this plugin to..</div>
149
+ <ul>
150
+ <li> - be supported on a FULL time basis?</li>
151
+ <li> - always work with the latest version of WordPress?</li>
152
+ <li> - have updates regularly released?</li>
153
+ <li> - be fixed quickly should any bugs/security issues arise?</li>
154
+ <li> - give you peace of mind and ALWAYS work on your website whether it is a business site, or personal?</li>
155
+ </ul>
156
+ <div style="margin-top:10px;">If you answered YES to any of these questions then you may wish to <a href="http://www.presscoders.com/members/signup.php" target="_blank">sign-up to our exclusive support package</a>, which is available to all users of our FREE plugins.</div>
157
+ <div style="margin-top:10px;">We are dedicated to bringing our users a range of high quality, stable FREE plugins. The only way we can continue to do this by providing support to users to cover the full time development of these plugins. We have many more plugins on the drawing board. Please help us to convert these ideas into working active plugins!</div>
158
+ <div style="margin-top:10px;">Click <a href="http://www.presscoders.com/wordpress-support/" target="_blank">here</a> for full details of support available for Simple Sitemap.</div>
159
+ <div style="margin-top:10px;">Or <a href="http://www.presscoders.com/members/signup.php" target="_blank">sign-up straight away</a> to get immediate access to support!</div>
160
+ </div>
161
+ <script>
162
+ jQuery("#pc_support_toggle").click(function(){
163
+ jQuery("#pc_support").toggle(400);
164
+ });
165
+ </script>
166
+
167
+ <p style="margin-top:20px;">Follow me on <a href="http://twitter.com/dgwyer" target="_blank">twitter</a>. Also, check out our new site: <a href="http://www.presscoders.com" target="_blank">PressCoders.com</a></p>
168
+
169
+ </div>
170
+ <?php
171
+ }
172
+
173
+ // Sanitize and validate input. Accepts an array, return a sanitized array.
174
+ function wpss_validate_options($input) {
175
+ // strip html from textboxes
176
+ // e.g. $input['textbox'] = wp_filter_nohtml_kses($input['textbox']);
177
+ return $input;
178
  }
179
 
180
  // ***************************************
188
  // ***************************************
189
 
190
  function add_my_stylesheet() {
191
+ $styleSheet = WP_PLUGIN_URL.'/simple-sitemap/css/ss_style.css';
192
  wp_register_style('myStyleSheets', $styleSheet);
193
  wp_enqueue_style( 'myStyleSheets');
194
  }
215
 
216
  // shortcode function
217
  function wpss_gen() {
218
+ ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
219
+
220
  global $post; //wordpress post global object
221
  $permalink_structure = get_option( 'permalink_structure' );
222
+ if($permalink_structure == null) {
223
+ $link_url = get_permalink($post->ID);
224
+ $query_symbol = '&'; // add a '&' character prefix onto the query string
225
+ }
226
+ else if((substr($permalink_structure, -1)) != '/') {
227
  $link_url = get_permalink($post->ID).'/';
228
+ $query_symbol = '?'; // add a '?' character prefix onto the query string
229
  }
230
  else {
231
  $link_url = get_permalink($post->ID);
232
+ $query_symbol = '?'; // add a '?' character prefix onto the query string
233
  }
234
+
235
  // sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages)
236
  $page_params = page_params();
237
  $post_params = post_params();
238
 
239
+ $opt = get_option('wpss_options');
240
+ //echo '$opt[\'drp_pages_default\'] = '.$opt['drp_pages_default'].'<br />';
241
+ //echo '$opt[\'drp_posts_default\'] = '.$opt['drp_posts_default'].'<br />';
242
+
243
+ if($page_params == null ) {
244
+ if($opt['drp_pages_default'] == "post_title") { $page_params = 'menu_order, post_title'; }
245
+ else if ($opt['drp_pages_default'] == "post_date") { $page_params = 'post_date'; }
246
+ else { $page_params = 'post_author'; }
247
+ }
248
+ $page_args=array( 'sort_column' => $page_params, 'title_li' => '');
249
+
250
+ if($post_params == null ) {
251
+ if($opt['drp_posts_default'] == "title") { $post_params = 'title'; }
252
+ else if ($opt['drp_posts_default'] == "date") { $post_params = 'date'; }
253
+ else if ($opt['drp_posts_default'] == "author") { $post_params = 'author'; }
254
+ else if ($opt['drp_posts_default'] == "category") { $post_params = 'category'; }
255
+ else { $post_params = 'tags'; }
256
+ }
257
+ $post_args=array( 'orderby' => $post_params, 'posts_per_page' => -1, 'order' => 'asc' );
258
+
259
+ //echo "<br />Page Args: <br />";
260
+ //print_r($page_args);
261
+ //echo "<br /><br />Posts Args: <br />";
262
+ //print_r($post_args);
263
+ //echo "<br /><br />Page Params: $page_params";
264
+ //echo "<br />Post Params: $post_params";
265
+
266
+ // Initialise to "" to prevent undefined variable error
267
+ $pt1=$pd1=$pa1=$pt2=$pd2=$pa2=$pc2=$ptg2="";
268
 
269
  // page drop down box
270
+ if($page_params == 'menu_order, post_title') {
271
  $pt1 = "selected='selected'";
272
  }
273
  else if($page_params == 'post_date') {
274
  $pd1 = "selected='selected'";
275
  }
 
 
 
 
 
 
 
 
 
276
  else if($page_params == 'post_author') {
277
  $pa1 = "selected='selected'";
278
  }
284
  else if($post_params == 'date') {
285
  $pd2 = "selected='selected'";
286
  }
 
 
 
 
 
 
 
 
 
287
  else if($post_params == 'author') {
288
  $pa2 = "selected='selected'";
289
  }
290
+ else if($post_params == 'category') {
291
+ $pc2 = "selected='selected'";
292
+ }
293
+ else if($post_params == 'tags') {
294
+ $ptg2 = "selected='selected'";
295
+ }
296
  ?>
297
+ <div class="ss_wrapper">
298
+ <?php
299
+ $opt = get_option('wpss_options');
300
+ if($opt['rdo_display_order'] == "pages_left") {
301
+ $pages_float = "float:left;";
302
+ }
303
+ else {
304
+ $pages_float = "float:right;";
305
+ }
306
+ ?>
307
+ <div id="ss_pages" style="<?php echo $pages_float ?>">
308
+ <h2 class='page_heading'>Pages</h2>
309
+
310
  <div id="page_drop_down">
311
+ <span id="page_dd_label">Show pages by:</span>
312
  <select>
313
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'pagesort=post_title'; ?>'" <?php echo $pt1; ?>>Title</option>
314
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'pagesort=post_date'; ?>'" <?php echo $pd1; ?>>Date</option>
315
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'pagesort=post_author'; ?>'" <?php echo $pa1; ?>>Author</option>
 
 
 
316
  </select>
317
  </div>
318
+ <?php
319
+ if(strpos($page_params, 'post_date') !== false) {
320
+ echo '<ul class="page_item_list">';
321
+ $page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', 'date_format' => ' (m.d.y)', 'show_date'=> 'created', 'title_li' => '');
322
+ wp_list_pages($page_args); // show the sorted pages
323
+ echo '</ul>';
324
+ }
325
+ elseif(strpos($page_params, 'post_author') !== false) {
326
+ $authors = get_users_of_blog(); //gets registered users
327
+ foreach ($authors as $author) {
328
+ $empty_page_args=array('echo' => 0, 'authors' => $author->user_id, 'title_li' => '');
329
+ $empty_test = wp_list_pages($empty_page_args); // test for authors with zero pages
330
+ //echo '$empty_test = '.$empty_test;
331
+
332
+ if($empty_test != null || $empty_test != "") {
333
+ echo "<div class='page_author'>$author->display_name</div>";
334
+ echo "<div class=\"ss_date_header\"><ul class=\"page_item_list\">";
335
+ $page_args=array('authors' => $author->user_id, 'title_li' => '');
336
+ wp_list_pages($page_args);
337
+ echo "</ul></div>";
338
+ }
339
+ else {
340
+ echo "<div class='page_author'>$author->display_name <span class=\"sticky\">(no pages published)</span></div>";
341
+ }
342
+ } ?>
343
+ <?php
344
+ }
345
+ else { // default = title
346
+ echo '<ul class="page_item_list">';
347
+ wp_list_pages($page_args); // show the sorted pages
348
+ echo '</ul>';
349
+ }
350
+ ?>
351
+ </div><!--ss_pages -->
352
+ <div id="ss_content_sep"></div>
353
+ <?php
354
+ $opt = get_option('wpss_options');
355
+ if($opt['rdo_display_order'] == "pages_left") {
356
+ $posts_float = "float:right;";
357
+ }
358
+ else {
359
+ $posts_float = "float:left;";
360
+ }
361
+ ?>
362
+ <div id="ss_posts" style="<?php echo $posts_float ?>">
363
+ <h2 class='post_heading'>Posts</h2>
364
  <div id="post_drop_down">
365
+ <span id="post_dd_label">Show posts by:</span>
366
  <select>
367
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'postsort=title'; ?>'" <?php echo $pt2; ?>>Title</option>
368
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'postsort=date'; ?>'" <?php echo $pd2; ?>>Date</option>
369
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'postsort=author'; ?>'" <?php echo $pa2; ?>>Author</option>
370
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'postsort=category'; ?>'" <?php echo $pc2; ?>>Category</option>
371
+ <option onClick="location.href='<?php echo $link_url.$query_symbol.'postsort=tags'; ?>'" <?php echo $ptg2; ?>>Tags</option>
 
372
  </select>
373
  </div>
374
+ <?php
375
+ if(strpos($post_params, 'category') !== false) {
376
+ $categories = get_categories();
377
+ foreach ($categories as $category) {
378
+ $category_link = get_category_link($category->term_id);
379
+ $cat_count = $category->category_count;
380
+
381
+ echo '<div class="ss_cat_header"><a href="'.$category_link.'">'.ucwords($category->cat_name).'</a> ';
382
+ query_posts('post_status=publish&cat='.$category->term_id); // show the sorted posts ?>
383
+ <?php
384
+ global $wp_query;
385
+ echo '('.$wp_query->post_count.')</div>'; ?>
386
+ <?php
387
+ if (have_posts()) :
388
+ echo '<div class="post_item_list"><ul class="post_item_list">';
389
  while (have_posts()) :
390
  the_post(); ?>
391
  <li id="post_item">
392
  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
393
  </li>
394
  <?php endwhile;
395
+ echo '</ul></div>';
396
  endif;
397
  wp_reset_query();
398
+ }
399
+ }
400
+ else if(strpos($post_params, 'author') !== false) {
401
+ $authors = get_users_of_blog(); //gets registered users
402
+ foreach ($authors as $author) {
403
+ echo '<a href="'.get_author_posts_url($author->user_id).'">'.$author->display_name.'</a> ';
404
+ query_posts('post_status=publish&author='.$author->user_id); // show the sorted posts ?>
405
+ <?php
406
+ global $wp_query;
407
+ echo '('.$wp_query->post_count.')'; ?>
408
+ <?php
409
+ if (have_posts()) :
410
+ echo '<div class="post_item_list"><ul class="post_item_list">';
411
+ while (have_posts()) :
412
+ the_post(); ?>
413
+ <li id="post_item">
414
+ <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
415
+ </li>
416
+ <?php endwhile;
417
+ echo '</ul></div>';
418
+ endif;
419
+ wp_reset_query();
420
+ }
421
+ }
422
+ else if(strpos($post_params, 'tags') !== false) {
423
+ $post_tags = get_tags();
424
+ echo '<div class="ss_tag_header">';
425
+ foreach ($post_tags as $tag){
426
+ $tag_link = get_tag_link($tag->term_id);
427
+ echo "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
428
+ echo "{$tag->name}</a> ($tag->count)";
429
 
430
+ query_posts('post_status=publish&tag='.$tag->slug); // show posts ?>
431
+ <?php
432
+ if (have_posts()) :
433
+ echo '<div class="post_item_list"><ul class="post_item_list">';
434
+ while (have_posts()) :
435
+ the_post(); ?>
436
+ <li id="post_item">
437
+ <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
438
+ </li>
439
+ <?php endwhile;
440
+ echo '</ul></div>';
441
+ endif;
442
+ wp_reset_query();
443
+ }
444
+ echo '</div>';
445
+ }
446
+ else if(strpos($post_params, 'date') !== false) {
447
+ ?><div class="ss_date_header">
448
+ <?php
449
+ global $wpdb;
450
+ $months = $wpdb->get_results("SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month, year ORDER BY post_date DESC");
451
+ foreach($months as $curr_month){
452
+ query_posts('post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?>
453
+ <?php
454
+ global $wp_query;
455
+ echo "<a href=";
456
+ echo get_month_link($curr_month->year, $curr_month->month);
457
+ echo '">'.date( 'F', mktime(0, 0, 0, $curr_month->month) ).' '.$curr_month->year.'</a> ('.$wp_query->post_count.')'; ?>
458
+ <?php
459
+ if (have_posts()) :
460
+ echo '<div class="post_item_list"><ul class="post_item_list">';
461
+ while (have_posts()) :
462
+ the_post(); ?>
463
+ <li id="post_item">
464
+ <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
465
+ </li>
466
+ <?php endwhile;
467
+ echo '</ul></div>';
468
+ endif;
469
+ wp_reset_query();
470
+ } ?>
471
+ </div>
472
+ <?php
473
+ }
474
+ else { // default = title
475
+ ?>
476
+ <?php query_posts($post_args); // show the sorted posts
477
+ if (have_posts()) :
478
+ echo '<ul class="post_item_list">';
479
+ while (have_posts()) :
480
+ the_post();
481
+ $sticky="";
482
+ if(is_sticky(get_the_ID())) { $sticky=" (sticky post)"; } ?>
483
+ <li id="post_item">
484
+ <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
485
+ <span class="sticky"><?php echo $sticky; ?></span>
486
+ </li>
487
+ <?php endwhile;
488
+ echo '</ul>';
489
+ endif;
490
+ wp_reset_query();
491
+ }
492
+ ?>
493
+ </div><!--ss_posts-->
494
+ </div>
495
  <?php
496
+
497
+ $output = ob_get_contents();;
498
+ ob_end_clean();
499
+
500
+ return $output;
501
+
502
  }
503
  // ***************************************
504
  // *** END - Plugin Core Functions ***
style.css DELETED
@@ -1,71 +0,0 @@
1
- .pagenav {
2
- font-family:Georgia, "Times New Roman", Times, serif;`
3
- /*font-size:14px;*/
4
- font-style:italic;
5
- list-style-type: none;
6
- margin: 0px 0px 0px 10px;
7
- }
8
-
9
- #content .page_heading {
10
- margin: 0px 0px 2px 0px;
11
- font-size: 16px;
12
- font-style: italic;
13
- }
14
-
15
- #content #tbl_output {
16
- border:0px white solid;
17
- }
18
-
19
- /* Page Sitemap CSS */
20
- .pagenav .page_item {
21
- font-size: 16px;
22
- font-weight: normal;
23
- font-style: normal;
24
- /*list-style-type: none;*/
25
- }
26
-
27
- #content #td_left {
28
- border: 0px white solid;
29
- border-right:1px #eee solid;
30
- width:50%;
31
- }
32
-
33
- #page_dd_label {
34
- margin-right:5px;
35
- }
36
-
37
- #page_drop_down {
38
- margin: 15px 0px -10px 10px;
39
- }
40
-
41
- /* Post Sitemap CSS */
42
- #post_item {
43
- font-size: 16px;
44
- font-weight: normal;
45
- font-style: normal;
46
- /*list-style-type: none;*/
47
- }
48
-
49
- #content #td_right {
50
- border: 0px white solid;
51
- width:50%;
52
- }
53
-
54
- #post_dd_label {
55
- margin-right:5px;
56
- }
57
-
58
- #post_item {
59
- border: 0px red solid;
60
- margin:0px 0px 0px 20px;
61
- }
62
-
63
- #post_drop_down {
64
- margin: 15px 0px -10px 0px;
65
- }
66
-
67
- #content .post_heading {
68
- margin: 0px 0px 2px 0px;
69
- font-size: 16px;
70
- font-style: italic;
71
- }