Version Description
Download this release
Release Info
Developer | dgwyer |
Plugin | Simple Sitemap – Automatically Generate a Responsive Sitemap |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.4
- readme.txt +9 -2
- simple-sitemap.php +76 -52
readme.txt
CHANGED
@@ -3,13 +3,15 @@ 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.2
|
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 |
This is probably the easiest way to add a powerful HTML sitemap to your site!
|
14 |
|
15 |
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.
|
@@ -65,6 +67,11 @@ The Plugin can also be installed directly from the main WordPress Plugin page.
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
*1.3.1*
|
69 |
|
70 |
* Fixed HTML bug. Replaced deprecated function.
|
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.3.2
|
7 |
+
Stable tag: 1.4
|
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: With version 1.4 you can now exclude pages by ID! This was a commonly requested feature. Also, ALL posts are now listed and are not restricted by the Settings -> Reading value.
|
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.
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
*1.4*
|
71 |
+
|
72 |
+
* Plugin option added to exclude pages by ID!
|
73 |
+
* Bug fix: ALL posts are now listed and are not restricted by the Settings -> Reading value.
|
74 |
+
|
75 |
*1.3.1*
|
76 |
|
77 |
* Fixed HTML bug. Replaced deprecated function.
|
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 |
*/
|
@@ -25,19 +25,27 @@ Author URI: http://www.presscoders.com
|
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
-
/*
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
*/
|
36 |
|
37 |
-
|
38 |
add_shortcode('simple-sitemap', 'wpss_gen');
|
39 |
add_filter('query_vars', 'parameter_queryvars' );
|
40 |
-
//add_action( 'plugins_loaded', 'wpss_generate' );
|
41 |
add_action('wp_print_styles', 'add_my_stylesheet');
|
42 |
|
43 |
register_activation_hook(__FILE__, 'wpss_add_defaults');
|
@@ -49,26 +57,31 @@ add_action('admin_menu', 'wpss_add_options_page');
|
|
49 |
// *** START - Create Admin Options ***
|
50 |
// ***************************************
|
51 |
|
52 |
-
|
53 |
function wpss_delete_plugin_options() {
|
54 |
delete_option('wpss_options');
|
55 |
}
|
56 |
|
57 |
-
|
58 |
function wpss_add_defaults() {
|
59 |
$tmp = get_option('wpss_options');
|
60 |
if(($tmp['chk_default_options_db']=='1')||(!is_array($tmp))) {
|
61 |
-
delete_option('wpss_options');
|
62 |
-
$arr = array("drp_pages_default"
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
}
|
66 |
|
67 |
-
|
68 |
function wpss_init(){
|
69 |
-
|
70 |
$tmp = get_option('wpss_options');
|
71 |
-
if(!$tmp['rdo_display_order'])
|
72 |
{
|
73 |
$tmp["rdo_display_order"] = "pages_left";
|
74 |
update_option('wpss_options', $tmp);
|
@@ -76,29 +89,18 @@ function wpss_init(){
|
|
76 |
register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' );
|
77 |
}
|
78 |
|
79 |
-
|
80 |
function wpss_add_options_page() {
|
81 |
add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form');
|
82 |
}
|
83 |
|
84 |
-
|
85 |
function wpss_render_form() {
|
86 |
?>
|
87 |
<div class="wrap">
|
88 |
<div class="icon32" id="icon-options-general"><br></div>
|
89 |
<h2>Simple Sitemap Options</h2>
|
90 |
-
<div style="background:#eee;border: 1px dashed #ccc;font-size: 13px;margin
|
91 |
-
<div style="margin-top:20px;width:800px;">
|
92 |
-
<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>
|
93 |
-
<div style="float:right;width:20%;">
|
94 |
-
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
95 |
-
<input type="hidden" name="cmd" value="_s-xclick">
|
96 |
-
<input type="hidden" name="hosted_button_id" value="UUFZZU35RZPW8">
|
97 |
-
<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.">
|
98 |
-
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
|
99 |
-
</form>
|
100 |
-
</div>
|
101 |
-
</div>
|
102 |
<form method="post" action="options.php">
|
103 |
<?php settings_fields('wpss_plugin_options'); ?>
|
104 |
<?php $options = get_option('wpss_options'); ?>
|
@@ -106,10 +108,11 @@ function wpss_render_form() {
|
|
106 |
<tr valign="top">
|
107 |
<th scope="row">Content Display Order</th>
|
108 |
<td>
|
109 |
-
<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
|
110 |
-
<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
|
111 |
</td>
|
112 |
</tr>
|
|
|
113 |
<tr>
|
114 |
<th scope="row">Pages Drop-Down Default</th>
|
115 |
<td>
|
@@ -120,6 +123,7 @@ function wpss_render_form() {
|
|
120 |
</select>
|
121 |
</td>
|
122 |
</tr>
|
|
|
123 |
<tr>
|
124 |
<th scope="row">Posts Drop-Down Default</th>
|
125 |
<td>
|
@@ -132,7 +136,16 @@ function wpss_render_form() {
|
|
132 |
</select>
|
133 |
</td>
|
134 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
<tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
|
|
|
136 |
<tr valign="top" style="border-top:#dddddd 1px solid;">
|
137 |
<th scope="row">Database Options</th>
|
138 |
<td>
|
@@ -146,16 +159,24 @@ function wpss_render_form() {
|
|
146 |
</p>
|
147 |
</form>
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
</div>
|
152 |
<?php
|
153 |
}
|
154 |
|
155 |
-
|
156 |
function wpss_validate_options($input) {
|
157 |
-
|
158 |
// e.g. $input['textbox'] = wp_filter_nohtml_kses($input['textbox']);
|
|
|
|
|
|
|
159 |
return $input;
|
160 |
}
|
161 |
|
@@ -195,7 +216,7 @@ function post_params() {
|
|
195 |
}
|
196 |
}
|
197 |
|
198 |
-
|
199 |
function wpss_gen() {
|
200 |
ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
|
201 |
|
@@ -214,7 +235,7 @@ function wpss_gen() {
|
|
214 |
$query_symbol = '?'; // add a '?' character prefix onto the query string
|
215 |
}
|
216 |
|
217 |
-
|
218 |
$page_params = page_params();
|
219 |
$post_params = post_params();
|
220 |
|
@@ -227,7 +248,8 @@ function wpss_gen() {
|
|
227 |
else if ($opt['drp_pages_default'] == "post_date") { $page_params = 'post_date'; }
|
228 |
else { $page_params = 'post_author'; }
|
229 |
}
|
230 |
-
$page_args=array( 'sort_column' => $page_params, 'title_li' => '');
|
|
|
231 |
|
232 |
if($post_params == null ) {
|
233 |
if($opt['drp_posts_default'] == "title") { $post_params = 'title'; }
|
@@ -236,7 +258,7 @@ function wpss_gen() {
|
|
236 |
else if ($opt['drp_posts_default'] == "category") { $post_params = 'category'; }
|
237 |
else { $post_params = 'tags'; }
|
238 |
}
|
239 |
-
$post_args=array( 'orderby' => $post_params, 'posts_per_page' => -1, 'order' => 'asc' );
|
240 |
|
241 |
//echo "<br />Page Args: <br />";
|
242 |
//print_r($page_args);
|
@@ -245,10 +267,10 @@ function wpss_gen() {
|
|
245 |
//echo "<br /><br />Page Params: $page_params";
|
246 |
//echo "<br />Post Params: $post_params";
|
247 |
|
248 |
-
|
249 |
$pt1=$pd1=$pa1=$pt2=$pd2=$pa2=$pc2=$ptg2="";
|
250 |
|
251 |
-
|
252 |
if($page_params == 'menu_order, post_title') {
|
253 |
$pt1 = "selected='selected'";
|
254 |
}
|
@@ -259,7 +281,7 @@ function wpss_gen() {
|
|
259 |
$pa1 = "selected='selected'";
|
260 |
}
|
261 |
|
262 |
-
|
263 |
if($post_params == 'title') {
|
264 |
$pt2 = "selected='selected'";
|
265 |
}
|
@@ -303,6 +325,7 @@ function wpss_gen() {
|
|
303 |
if(strpos($page_params, 'post_date') !== false) {
|
304 |
echo '<ul class="page_item_list">';
|
305 |
$page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', 'date_format' => ' (m.d.y)', 'show_date'=> 'created', 'title_li' => '');
|
|
|
306 |
wp_list_pages($page_args); // show the sorted pages
|
307 |
echo '</ul>';
|
308 |
}
|
@@ -317,6 +340,7 @@ function wpss_gen() {
|
|
317 |
echo "<div class='page_author'>$author->display_name</div>";
|
318 |
echo "<div class=\"ss_date_header\"><ul class=\"page_item_list\">";
|
319 |
$page_args=array('authors' => $author->ID, 'title_li' => '');
|
|
|
320 |
wp_list_pages($page_args);
|
321 |
echo "</ul></div>";
|
322 |
}
|
@@ -326,9 +350,9 @@ function wpss_gen() {
|
|
326 |
} ?>
|
327 |
<?php
|
328 |
}
|
329 |
-
else {
|
330 |
echo '<ul class="page_item_list">';
|
331 |
-
wp_list_pages($page_args);
|
332 |
echo '</ul>';
|
333 |
}
|
334 |
?>
|
@@ -365,7 +389,7 @@ function wpss_gen() {
|
|
365 |
$cat_count = $category->category_count;
|
366 |
|
367 |
echo '<div class="ss_cat_header"><a href="'.$category_link.'">'.ucwords($category->cat_name).'</a> ';
|
368 |
-
query_posts('post_status=publish&cat='.$category->term_id); // show the sorted posts ?>
|
369 |
<?php
|
370 |
global $wp_query;
|
371 |
echo '('.$wp_query->post_count.')</div>'; ?>
|
@@ -387,7 +411,7 @@ function wpss_gen() {
|
|
387 |
$authors = get_users(); //gets registered users
|
388 |
foreach ($authors as $author) {
|
389 |
echo '<a href="'.get_author_posts_url($author->ID).'">'.$author->display_name.'</a> ';
|
390 |
-
query_posts('post_status=publish&author='.$author->ID); // show the sorted posts ?>
|
391 |
<?php
|
392 |
global $wp_query;
|
393 |
echo '('.$wp_query->post_count.')'; ?>
|
@@ -413,7 +437,7 @@ function wpss_gen() {
|
|
413 |
echo "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
|
414 |
echo "{$tag->name}</a> ($tag->count)";
|
415 |
|
416 |
-
query_posts('post_status=publish&tag='.$tag->slug); // show posts ?>
|
417 |
<?php
|
418 |
if (have_posts()) :
|
419 |
echo '<div class="post_item_list"><ul class="post_item_list">';
|
@@ -435,7 +459,7 @@ function wpss_gen() {
|
|
435 |
global $wpdb;
|
436 |
$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");
|
437 |
foreach($months as $curr_month){
|
438 |
-
query_posts('post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?>
|
439 |
<?php
|
440 |
global $wp_query;
|
441 |
echo "<a href=\"";
|
@@ -457,9 +481,9 @@ function wpss_gen() {
|
|
457 |
</div>
|
458 |
<?php
|
459 |
}
|
460 |
-
else {
|
461 |
?>
|
462 |
-
<?php query_posts($post_args);
|
463 |
if (have_posts()) :
|
464 |
echo '<ul class="post_item_list">';
|
465 |
while (have_posts()) :
|
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.4
|
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 |
+
/* Next Plugin release to do:
|
29 |
+
- Show all the posts in each category not just the maximum allowed in Settings -> Reading.
|
30 |
+
|
31 |
+
*/
|
32 |
+
|
33 |
+
/* Future to do:
|
34 |
+
- Be able to sort ascending/descending in addition to the sort drop down options for each list.
|
35 |
+
- Have styling (in Plugins options page textarea?) to control sitemap rendering.
|
36 |
+
- Add all 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 |
+
- Check which pages the simple-sitemap css is loaded. Don't really want it showing on pages that are not sitemap pages. It's being loaded on all pages currently?
|
39 |
+
- Consider adding a drop down in Plugin options to show the page hierchy as it appears in 'Pages' (i.e. the way it works now), or to show it via a defined custom menu hierarchy.
|
40 |
+
- Include option to show only posts/or pages.
|
41 |
+
- Add option to include CPT posts?
|
42 |
+
- Add option to show/hide drop down boxes on sitemap page.
|
43 |
+
- Use the 'prepare' WP feature when querying the db directly.
|
44 |
*/
|
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', 'parameter_queryvars' );
|
|
|
49 |
add_action('wp_print_styles', 'add_my_stylesheet');
|
50 |
|
51 |
register_activation_hook(__FILE__, 'wpss_add_defaults');
|
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');
|
63 |
}
|
64 |
|
65 |
+
/* Define default option settings. */
|
66 |
function wpss_add_defaults() {
|
67 |
$tmp = get_option('wpss_options');
|
68 |
if(($tmp['chk_default_options_db']=='1')||(!is_array($tmp))) {
|
69 |
+
delete_option('wpss_options');
|
70 |
+
$arr = array( "drp_pages_default" => "post_title",
|
71 |
+
"drp_posts_default" => "title",
|
72 |
+
"chk_default_options_db" => "0",
|
73 |
+
"rdo_display_order" => "pages_left",
|
74 |
+
"txt_page_ids" => ""
|
75 |
+
);
|
76 |
+
update_option( 'wpss_options', $arr );
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
/* Init plugin options to white list our options. */
|
81 |
function wpss_init(){
|
82 |
+
/* This is primarily to check newly added options have correct initial values. */
|
83 |
$tmp = get_option('wpss_options');
|
84 |
+
if(!$tmp['rdo_display_order']) /* Check radio buttons have a starting value. */
|
85 |
{
|
86 |
$tmp["rdo_display_order"] = "pages_left";
|
87 |
update_option('wpss_options', $tmp);
|
89 |
register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' );
|
90 |
}
|
91 |
|
92 |
+
/* Add menu page. */
|
93 |
function wpss_add_options_page() {
|
94 |
add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form');
|
95 |
}
|
96 |
|
97 |
+
/* Draw the menu page itself. */
|
98 |
function wpss_render_form() {
|
99 |
?>
|
100 |
<div class="wrap">
|
101 |
<div class="icon32" id="icon-options-general"><br></div>
|
102 |
<h2>Simple Sitemap Options</h2>
|
103 |
+
<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, enter the following <a href="http://codex.wordpress.org/Shortcode_API" target="_blank">shortcode</a>: <b>[simple-sitemap]</b></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
<form method="post" action="options.php">
|
105 |
<?php settings_fields('wpss_plugin_options'); ?>
|
106 |
<?php $options = get_option('wpss_options'); ?>
|
108 |
<tr valign="top">
|
109 |
<th scope="row">Content Display Order</th>
|
110 |
<td>
|
111 |
+
<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<span style="margin-left:10px;color: #999;">(with pages on the RHS)</span></label><br />
|
112 |
+
<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<span style="margin-left:10px;color: #999;">(with posts on the RHS)</span></label><br />
|
113 |
</td>
|
114 |
</tr>
|
115 |
+
|
116 |
<tr>
|
117 |
<th scope="row">Pages Drop-Down Default</th>
|
118 |
<td>
|
123 |
</select>
|
124 |
</td>
|
125 |
</tr>
|
126 |
+
|
127 |
<tr>
|
128 |
<th scope="row">Posts Drop-Down Default</th>
|
129 |
<td>
|
136 |
</select>
|
137 |
</td>
|
138 |
</tr>
|
139 |
+
|
140 |
+
<tr>
|
141 |
+
<th scope="row">Exclude Pages</th>
|
142 |
+
<td>
|
143 |
+
<input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>" /><span style="margin-left:10px;color: #999;">Enter a comma separated list of Page ID's.</span>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
|
147 |
<tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
|
148 |
+
|
149 |
<tr valign="top" style="border-top:#dddddd 1px solid;">
|
150 |
<th scope="row">Database Options</th>
|
151 |
<td>
|
159 |
</p>
|
160 |
</form>
|
161 |
|
162 |
+
<p style="margin-top:20px">
|
163 |
+
<span><a href="http://www.facebook.com/PressCoders" title="Our Facebook page" target="_blank"><img style="border:1px #ccc solid;" src="<?php echo plugins_url(); ?>/simple-sitemap/images/facebook-icon.png" /></a></span>
|
164 |
+
<span><a href="http://www.twitter.com/dgwyer" title="Follow on Twitter" target="_blank"><img style="border:1px #ccc solid;" src="<?php echo plugins_url(); ?>/simple-sitemap/images/twitter-icon.png" /></a></span>
|
165 |
+
<span><a href="http://www.presscoders.com" title="PressCoders.com" target="_blank"><img style="border:1px #ccc solid;" src="<?php echo plugins_url(); ?>/simple-sitemap/images/pc-icon.png" /></a></span>
|
166 |
+
<span style="margin-left:10px;">If you like this Plugin <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. Thanks.</span>
|
167 |
+
</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 |
+
|
178 |
+
$input['txt_page_ids'] = sanitize_text_field( $input['txt_page_ids'] );
|
179 |
+
|
180 |
return $input;
|
181 |
}
|
182 |
|
216 |
}
|
217 |
}
|
218 |
|
219 |
+
/* Shortcode function. */
|
220 |
function wpss_gen() {
|
221 |
ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
|
222 |
|
235 |
$query_symbol = '?'; // add a '?' character prefix onto the query string
|
236 |
}
|
237 |
|
238 |
+
/* Sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages). */
|
239 |
$page_params = page_params();
|
240 |
$post_params = post_params();
|
241 |
|
248 |
else if ($opt['drp_pages_default'] == "post_date") { $page_params = 'post_date'; }
|
249 |
else { $page_params = 'post_author'; }
|
250 |
}
|
251 |
+
$page_args = array( 'sort_column' => $page_params, 'title_li' => '');
|
252 |
+
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
253 |
|
254 |
if($post_params == null ) {
|
255 |
if($opt['drp_posts_default'] == "title") { $post_params = 'title'; }
|
258 |
else if ($opt['drp_posts_default'] == "category") { $post_params = 'category'; }
|
259 |
else { $post_params = 'tags'; }
|
260 |
}
|
261 |
+
$post_args = array( 'orderby' => $post_params, 'posts_per_page' => -1, 'order' => 'asc' );
|
262 |
|
263 |
//echo "<br />Page Args: <br />";
|
264 |
//print_r($page_args);
|
267 |
//echo "<br /><br />Page Params: $page_params";
|
268 |
//echo "<br />Post Params: $post_params";
|
269 |
|
270 |
+
/* Initialise to "" to prevent undefined variable error. */
|
271 |
$pt1=$pd1=$pa1=$pt2=$pd2=$pa2=$pc2=$ptg2="";
|
272 |
|
273 |
+
/* Page drop down box. */
|
274 |
if($page_params == 'menu_order, post_title') {
|
275 |
$pt1 = "selected='selected'";
|
276 |
}
|
281 |
$pa1 = "selected='selected'";
|
282 |
}
|
283 |
|
284 |
+
/* Post drop down box. */
|
285 |
if($post_params == 'title') {
|
286 |
$pt2 = "selected='selected'";
|
287 |
}
|
325 |
if(strpos($page_params, 'post_date') !== false) {
|
326 |
echo '<ul class="page_item_list">';
|
327 |
$page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', 'date_format' => ' (m.d.y)', 'show_date'=> 'created', 'title_li' => '');
|
328 |
+
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
329 |
wp_list_pages($page_args); // show the sorted pages
|
330 |
echo '</ul>';
|
331 |
}
|
340 |
echo "<div class='page_author'>$author->display_name</div>";
|
341 |
echo "<div class=\"ss_date_header\"><ul class=\"page_item_list\">";
|
342 |
$page_args=array('authors' => $author->ID, 'title_li' => '');
|
343 |
+
if( !empty( $opt['txt_page_ids'] ) ) $page_args['exclude'] = $opt['txt_page_ids'];
|
344 |
wp_list_pages($page_args);
|
345 |
echo "</ul></div>";
|
346 |
}
|
350 |
} ?>
|
351 |
<?php
|
352 |
}
|
353 |
+
else { /* default = title */
|
354 |
echo '<ul class="page_item_list">';
|
355 |
+
wp_list_pages($page_args); /* Show sorted pages with default $page_args. */
|
356 |
echo '</ul>';
|
357 |
}
|
358 |
?>
|
389 |
$cat_count = $category->category_count;
|
390 |
|
391 |
echo '<div class="ss_cat_header"><a href="'.$category_link.'">'.ucwords($category->cat_name).'</a> ';
|
392 |
+
query_posts('posts_per_page=-1&post_status=publish&cat='.$category->term_id); // show the sorted posts ?>
|
393 |
<?php
|
394 |
global $wp_query;
|
395 |
echo '('.$wp_query->post_count.')</div>'; ?>
|
411 |
$authors = get_users(); //gets registered users
|
412 |
foreach ($authors as $author) {
|
413 |
echo '<a href="'.get_author_posts_url($author->ID).'">'.$author->display_name.'</a> ';
|
414 |
+
query_posts('posts_per_page=-1&post_status=publish&author='.$author->ID); // show the sorted posts ?>
|
415 |
<?php
|
416 |
global $wp_query;
|
417 |
echo '('.$wp_query->post_count.')'; ?>
|
437 |
echo "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
|
438 |
echo "{$tag->name}</a> ($tag->count)";
|
439 |
|
440 |
+
query_posts('posts_per_page=-1&post_status=publish&tag='.$tag->slug); // show posts ?>
|
441 |
<?php
|
442 |
if (have_posts()) :
|
443 |
echo '<div class="post_item_list"><ul class="post_item_list">';
|
459 |
global $wpdb;
|
460 |
$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");
|
461 |
foreach($months as $curr_month){
|
462 |
+
query_posts('posts_per_page=-1&post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?>
|
463 |
<?php
|
464 |
global $wp_query;
|
465 |
echo "<a href=\"";
|
481 |
</div>
|
482 |
<?php
|
483 |
}
|
484 |
+
else { /* default = title */
|
485 |
?>
|
486 |
+
<?php query_posts($post_args); /* Show sorted posts with default $post_args. */
|
487 |
if (have_posts()) :
|
488 |
echo '<ul class="post_item_list">';
|
489 |
while (have_posts()) :
|