Version Description
Download this release
Release Info
Developer | dgwyer |
Plugin | Simple Sitemap – Automatically Generate a Responsive Sitemap |
Version | 1.8 |
Comparing to | |
See all releases |
Code changes from version 1.7 to 1.8
- readme.txt +34 -29
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- simple-sitemap.php +220 -394
readme.txt
CHANGED
@@ -2,44 +2,44 @@
|
|
2 |
Contributors: dgwyer
|
3 |
Tags: sitemap, html, global, sort, shortcode, pages, posts
|
4 |
Requires at least: 2.7
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
-
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
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.
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
* Title
|
27 |
-
* Date
|
28 |
-
* Author
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
* Date
|
34 |
-
* Author
|
35 |
-
* Category
|
36 |
-
* Tag
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
See our <a href="http://www.wpgothemes.com" target="_blank">WordPress development site</a> for more information.
|
43 |
|
44 |
== Installation ==
|
45 |
|
@@ -52,13 +52,18 @@ See our <a href="http://www.wpgothemes.com" target="_blank">WordPress developmen
|
|
52 |
|
53 |
== Screenshots ==
|
54 |
|
55 |
-
1.
|
56 |
-
2.
|
57 |
-
3. Plugin admin
|
58 |
-
4. Shows the results of changing Plugin admin options to swap posts/page display order.
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
*1.7 update*
|
63 |
|
64 |
* Translation support added!
|
2 |
Contributors: dgwyer
|
3 |
Tags: sitemap, html, global, sort, shortcode, pages, posts
|
4 |
Requires at least: 2.7
|
5 |
+
Tested up to: 4.4
|
6 |
+
Stable tag: 1.8
|
7 |
|
8 |
+
Powerful but simple to use HTML sitemap. Display site content in one or more lists separated by post type, customized via flexible filters.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
This is probably the easiest way to add a powerful HTML sitemap to your site! Simply enter the <code>[simple-sitemap]</code> shortcode in a post, page, custom post type, or text widget and you're good to go. Simple as that!
|
13 |
|
14 |
+
The sitemap shortcode has several attributes you can use to control how the sitemap is rendered including:
|
15 |
|
16 |
+
'types': comma separated list of post types to display in the sitemap
|
17 |
+
'show_label': show the heading label for each post ['true'|'false']
|
18 |
+
'links': show sitemap list as links or plain text ['true'|'false']
|
19 |
+
'page_depth': hierarchy of child pages to show [0|1|2|3]
|
20 |
+
'order': sort order of list ['asc'|'desc']
|
21 |
+
'orderby': field to sort by [title|author|date|ID]
|
22 |
+
'exclude': comma separated list of post IDs to exclude
|
23 |
|
24 |
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.
|
25 |
|
26 |
+
To display the sitemap simply add the [simple-sitemap] shortcode to any post or page (or text widget) and you'll have a full indexed sitemap enabled on your website!
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
Simple Sitemap Pro version coming soon!
|
29 |
+
- Render your sitemap in multiple columns, or even inside tabs!
|
30 |
+
- Customize each of the lists in your sitemap, rather than have settings apply to all post types?
|
31 |
+
- Advanced filtering of posts via taxonomies.
|
32 |
+
- Group posts inside each post type list by author, date, taxonomy etc.
|
33 |
+
- Three additional shortcodes to achieve exactly the sitemap layout you need.
|
34 |
+
- Add multiple specialized lists to different pages. e.g. different sitemaps for different custom post types, or different categories from the same post type.
|
35 |
+
- Finer granular control over how the sitemap is rendered.
|
36 |
+
- And more..!
|
37 |
|
38 |
+
Let us know what you'd like to see in the Pro version <a href="http://wpgoplugins.com/contact-us/" target="_blank">here</a>.
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
Please rate this Plugin if you find it useful. It only takes a couple of seconds and is very much appreciated! :)
|
41 |
|
42 |
+
See our <a href="http://www.wpgoplugins.com" target="_blank">WordPress plugin site</a> for more plugins.
|
|
|
|
|
43 |
|
44 |
== Installation ==
|
45 |
|
52 |
|
53 |
== Screenshots ==
|
54 |
|
55 |
+
1. Once plugin has been activated simply add the [simple-sitemap] shortcode to any page, post, or text widget.
|
56 |
+
2. Simple Sitemap displays a list of all the specified post types.
|
57 |
+
3. Plugin admin page details all the shortcode attributes available.
|
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
61 |
+
*1.8 update*
|
62 |
+
|
63 |
+
* Plugin completely rewritten to include a range of shortcode attributes to make rendering the sitemap much more flexible!
|
64 |
+
* All previous plugin options removed from the plugin settings page. Use the new shortcode attributes instead. See the plugin settings page for full deatils.
|
65 |
+
* New, cleaner HTML and CSS. New CSS classes used.
|
66 |
+
|
67 |
*1.7 update*
|
68 |
|
69 |
* Translation support added!
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
DELETED
Binary file
|
simple-sitemap.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Simple Sitemap
|
4 |
Plugin URI: http://wordpress.org/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.wpgothemes.com
|
9 |
Text Domain: simple-sitemap
|
@@ -26,78 +26,17 @@ Text Domain: simple-sitemap
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
/* @todo:
|
30 |
-
* - If bbPress is activated then it indexes my bbpress forums as: forums, topics, replies. When I add options to show a list of CPT to display/hide
|
31 |
-
* then make sure these three are showing in the list so users can manage visibility.
|
32 |
-
* - Change the exclude page ID setting to be valid for all post types, just input a list of post id's to exclude.
|
33 |
-
* - Redo Plugin screenshots.
|
34 |
-
* - 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.
|
35 |
-
* - Add option that if a page ID is excluded, it also excludes its children?
|
36 |
-
* - Get rid of query_posts().
|
37 |
-
* - 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.
|
38 |
-
* - Add archive pages to sitemap: http://wordpress.org/support/topic/include-archive-urls.
|
39 |
-
* - Be able to sort ascending/descending in addition to the sort drop down options for each list.
|
40 |
-
* - Add all Plugin options page in-line styles to external style sheet.
|
41 |
-
* - Options to display custom post types, with ability to show which custom post types to display or not display, and in what order?
|
42 |
-
* - 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.
|
43 |
-
* - Add option to remove certain tags, categories, or posts.
|
44 |
-
* - Use the 'prepare' WP feature when querying the db directly.
|
45 |
-
* - Use translation functions _e(), __() etc. Add Plugin text domain too.
|
46 |
-
* - Show all the posts in each category not just the maximum allowed in Settings -> Reading.
|
47 |
-
* - Update Plugin description and other sections, as well as the images which are out of date (show the single column working on the sidebar).
|
48 |
-
* - Maybe support shortcode attributes so that users can specify to add custom behaviour for individual sitemaps if more than one is needed on a site. Any attributes would override global Plugin settings that affects all sitemaps by default.
|
49 |
-
* - Exclude certain posts and categories from showing, similar to how pages can be excluded. Later extend this to CPT posts and archives too.
|
50 |
-
*/
|
51 |
-
|
52 |
/* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
|
53 |
-
add_shortcode( 'simple-sitemap', 'wpss_gen' );
|
54 |
|
55 |
-
|
56 |
-
register_uninstall_hook( __FILE__, 'wpss_delete_plugin_options' );
|
57 |
add_action( 'admin_init', 'wpss_init' );
|
58 |
add_action( 'admin_menu', 'wpss_add_options_page' );
|
59 |
add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
|
60 |
add_filter( 'widget_text', 'do_shortcode' ); // make sitemap shortcode work in text widgets
|
61 |
add_action( 'plugins_loaded', 'wpss_localize_plugin' );
|
62 |
|
63 |
-
/* Delete options table entries ONLY when plugin deactivated AND deleted. */
|
64 |
-
function wpss_delete_plugin_options() {
|
65 |
-
delete_option( 'wpss_options' );
|
66 |
-
}
|
67 |
-
|
68 |
-
/* Define default option settings. */
|
69 |
-
function wpss_add_defaults() {
|
70 |
-
|
71 |
-
$tmp = get_option( 'wpss_options' );
|
72 |
-
if ( ( ( isset( $tmp['chk_default_options_db'] ) && $tmp['chk_default_options_db'] == '1' ) ) || ( ! is_array( $tmp ) ) ) {
|
73 |
-
delete_option( 'wpss_options' );
|
74 |
-
$arr = array( "drp_pages_default" => "post_title",
|
75 |
-
"drp_posts_default" => "title",
|
76 |
-
"chk_default_options_db" => "0",
|
77 |
-
"chk_show_pages" => "1",
|
78 |
-
"chk_show_cpts" => "1",
|
79 |
-
"chk_show_posts" => "1",
|
80 |
-
"txt_page_ids" => ""
|
81 |
-
);
|
82 |
-
update_option( 'wpss_options', $arr );
|
83 |
-
}
|
84 |
-
|
85 |
-
// Make sure that something displays on the front end (i.e. the post, page, CPT check boxes are not all off)
|
86 |
-
$tmp1 = get_option( 'wpss_options' );
|
87 |
-
if ( isset( $tmp1 ) && is_array( $tmp1 ) ) {
|
88 |
-
if ( ! ( isset( $tmp1['chk_show_posts'] ) && $tmp1['chk_show_posts'] ) && ! ( isset( $tmp1['chk_show_pages'] ) && $tmp1['chk_show_pages'] ) ) {
|
89 |
-
// show pages and posts if nothing selected
|
90 |
-
$tmp1['chk_show_pages'] = "1";
|
91 |
-
$tmp1['chk_show_posts'] = "1";
|
92 |
-
}
|
93 |
-
|
94 |
-
update_option( 'wpss_options', $tmp1 );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
/* Init plugin options to white list our options. */
|
99 |
function wpss_init() {
|
100 |
-
|
101 |
register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' );
|
102 |
}
|
103 |
|
@@ -112,99 +51,46 @@ function wpss_render_form() {
|
|
112 |
<div class="wrap">
|
113 |
<h2><?php _e( 'Simple Sitemap Options', 'simple-sitemap' ); ?></h2>
|
114 |
|
|
|
|
|
|
|
|
|
115 |
<div style="background:#fff;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">
|
116 |
-
<?php printf( __( 'To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following
|
117 |
</div>
|
118 |
-
<form method="post" action="options.php">
|
119 |
-
<?php settings_fields( 'wpss_plugin_options' ); ?>
|
120 |
-
<?php $options = get_option( 'wpss_options' ); ?>
|
121 |
-
<table class="form-table">
|
122 |
-
<tr>
|
123 |
-
<th scope="row"><?php _e( 'Pages Default List Type', 'simple-sitemap' ); ?></th>
|
124 |
-
<td>
|
125 |
-
<select style="width:90px;" name='wpss_options[drp_pages_default]'>
|
126 |
-
<option value='post_title' <?php selected( 'post_title', $options['drp_pages_default'] ); ?>><?php _e( 'Title', 'simple-sitemap' ); ?></option>
|
127 |
-
<option value='post_date' <?php selected( 'post_date', $options['drp_pages_default'] ); ?>><?php _e( 'Date', 'simple-sitemap' ); ?></option>
|
128 |
-
<option value='post_author' <?php selected( 'post_author', $options['drp_pages_default'] ); ?>><?php _e( 'Author', 'simple-sitemap' ); ?></option>
|
129 |
-
</select>
|
130 |
-
</td>
|
131 |
-
</tr>
|
132 |
-
|
133 |
-
<tr>
|
134 |
-
<th scope="row"><?php _e( 'Posts Default List Type', 'simple-sitemap' ); ?></th>
|
135 |
-
<td>
|
136 |
-
<select style="width:90px;" name='wpss_options[drp_posts_default]'>
|
137 |
-
<option value='title' <?php selected( 'title', $options['drp_posts_default'] ); ?>><?php _e( 'Title', 'simple-sitemap' ); ?></option>
|
138 |
-
<option value='date' <?php selected( 'date', $options['drp_posts_default'] ); ?>><?php _e( 'Date', 'simple-sitemap' ); ?></option>
|
139 |
-
<option value='author' <?php selected( 'author', $options['drp_posts_default'] ); ?>><?php _e( 'Author', 'simple-sitemap' ); ?></option>
|
140 |
-
<option value='category' <?php selected( 'category', $options['drp_posts_default'] ); ?>><?php _e( 'Category', 'simple-sitemap' ); ?></option>
|
141 |
-
<option value='tags' <?php selected( 'tags', $options['drp_posts_default'] ); ?>><?php _e( 'Tags', 'simple-sitemap' ); ?></option>
|
142 |
-
</select>
|
143 |
-
</td>
|
144 |
-
</tr>
|
145 |
-
|
146 |
-
<tr>
|
147 |
-
<th scope="row"><?php _e( 'Exclude Pages', 'simple-sitemap' ); ?></th>
|
148 |
-
<td>
|
149 |
-
<input type="text" size="30" name="wpss_options[txt_page_ids]" value="<?php echo $options['txt_page_ids']; ?>">
|
150 |
-
|
151 |
-
<p class="description"><?php _e( 'Enter a comma separated list of Page ID\'s.', 'simple-sitemap' ); ?></p>
|
152 |
-
</td>
|
153 |
-
</tr>
|
154 |
-
|
155 |
-
<tr>
|
156 |
-
<th scope="row"><?php _e( 'Show Pages', 'simple-sitemap' ); ?></th>
|
157 |
-
<td>
|
158 |
-
<label><input name="wpss_options[chk_show_pages]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_pages'] ) ) {
|
159 |
-
checked( '1', $options['chk_show_pages'] );
|
160 |
-
} ?>> <?php _e( 'Display pages on front end sitemap?', 'simple-sitemap' ); ?></label>
|
161 |
-
</td>
|
162 |
-
</tr>
|
163 |
-
|
164 |
-
<tr>
|
165 |
-
<th scope="row"><?php _e( 'Show Posts', 'simple-sitemap' ); ?></th>
|
166 |
-
<td>
|
167 |
-
<label><input name="wpss_options[chk_show_posts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_posts'] ) ) {
|
168 |
-
checked( '1', $options['chk_show_posts'] );
|
169 |
-
} ?>> <?php _e( 'Display posts on front end sitemap?', 'simple-sitemap' ); ?></label>
|
170 |
-
</td>
|
171 |
-
</tr>
|
172 |
-
|
173 |
-
<tr>
|
174 |
-
<th scope="row"><?php _e( 'Show Custom Post Types', 'simple-sitemap' ); ?></th>
|
175 |
-
<td>
|
176 |
-
<label><input name="wpss_options[chk_show_cpts]" type="checkbox" value="1" <?php if ( isset( $options['chk_show_cpts'] ) ) {
|
177 |
-
checked( '1', $options['chk_show_cpts'] );
|
178 |
-
} ?>> <?php _e( 'Display Custom Post Types on front end sitemap?', 'simple-sitemap' ); ?></label>
|
179 |
-
</td>
|
180 |
-
</tr>
|
181 |
-
|
182 |
-
<tr valign="top" style="border-top:#dddddd 1px solid;">
|
183 |
-
<th scope="row"><?php _e( 'Database Options', 'simple-sitemap' ); ?></th>
|
184 |
-
<td>
|
185 |
-
<label><input name="wpss_options[chk_default_options_db]" type="checkbox" value="1" <?php if ( isset( $options['chk_default_options_db'] ) ) {
|
186 |
-
checked( '1', $options['chk_default_options_db'] );
|
187 |
-
} ?>> <?php _e( 'Restore Plugin defaults upon deactivation/reactivation', 'simple-sitemap' ); ?></label>
|
188 |
-
|
189 |
-
<p class="description"><?php _e( 'Only check this if you want to reset plugin settings upon reactivation', 'simple-sitemap' ); ?></p>
|
190 |
-
</td>
|
191 |
-
</tr>
|
192 |
-
</table>
|
193 |
-
<p class="submit">
|
194 |
-
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'simple-sitemap' ) ?>">
|
195 |
-
</p>
|
196 |
-
</form>
|
197 |
|
198 |
-
|
199 |
|
200 |
-
|
201 |
-
if( strtotime($discount_date) > strtotime('now') ) {
|
202 |
-
echo '<p style="background: #fff;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'For a limited time only! <strong>Get 50% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>MINN50OFF</code>', 'simple-sitemap' ) . '</p>';
|
203 |
-
} else {
|
204 |
-
echo '<p style="background: #eee;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'As a user of our free plugins here\'s a bonus just for you! <strong>Get 30% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>WPGO30OFF</code>', 'simple-sitemap' ) . '</p>';
|
205 |
-
}
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
<div style="clear:both;">
|
210 |
<p>
|
@@ -214,286 +100,226 @@ function wpss_render_form() {
|
|
214 |
</p>
|
215 |
</div>
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
</div>
|
218 |
<?php
|
219 |
}
|
220 |
|
221 |
/* Shortcode function. */
|
222 |
-
function
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
}
|
237 |
-
}
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
$post_params = 'date';
|
250 |
-
} else {
|
251 |
-
if ( $opt['drp_posts_default'] == "author" ) {
|
252 |
-
$post_params = 'author';
|
253 |
-
} else {
|
254 |
-
if ( $opt['drp_posts_default'] == "category" ) {
|
255 |
-
$post_params = 'category';
|
256 |
-
} else {
|
257 |
-
$post_params = 'tags';
|
258 |
-
}
|
259 |
-
}
|
260 |
}
|
261 |
-
}
|
262 |
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
|
267 |
-
|
|
|
268 |
|
269 |
-
|
270 |
|
271 |
-
|
272 |
|
273 |
-
|
|
|
274 |
|
275 |
-
|
|
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
$page_args = array( 'sort_order' => 'desc', 'sort_column' => 'post_date', 'title_li' => '' );
|
281 |
-
if ( ! empty( $opt['txt_page_ids'] ) ) {
|
282 |
-
$page_args['exclude'] = $opt['txt_page_ids'];
|
283 |
-
}
|
284 |
-
wp_list_pages( $page_args ); // show the sorted pages
|
285 |
-
echo '</ul>';
|
286 |
-
} elseif ( strpos( $page_params, 'post_author' ) !== false ) {
|
287 |
-
$authors = get_users(); //gets registered users
|
288 |
-
foreach ( $authors as $author ) {
|
289 |
-
$empty_page_args = array( 'echo' => 0, 'authors' => $author->ID, 'title_li' => '' );
|
290 |
-
$empty_test = wp_list_pages( $empty_page_args ); // test for authors with zero pages
|
291 |
-
//echo '$empty_test = '.$empty_test;
|
292 |
-
|
293 |
-
if ( $empty_test != null || $empty_test != "" ) {
|
294 |
-
echo "<div class='page_author'>$author->display_name</div>";
|
295 |
-
echo "<div class=\"ss_date_header\"><ul class=\"page_item_list\">";
|
296 |
-
$page_args = array( 'authors' => $author->ID, 'title_li' => '' );
|
297 |
-
if ( ! empty( $opt['txt_page_ids'] ) ) {
|
298 |
-
$page_args['exclude'] = $opt['txt_page_ids'];
|
299 |
-
}
|
300 |
-
wp_list_pages( $page_args );
|
301 |
-
echo "</ul></div>";
|
302 |
} else {
|
303 |
-
|
304 |
}
|
305 |
-
} ?>
|
306 |
-
<?php
|
307 |
-
} else { /* default = title */
|
308 |
-
echo '<ul class="page_item_list">';
|
309 |
-
wp_list_pages( $page_args ); /* Show sorted pages with default $page_args. */
|
310 |
-
echo '</ul>';
|
311 |
-
}
|
312 |
-
?>
|
313 |
-
</div><!--ss_pages -->
|
314 |
-
|
315 |
-
<?php endif; ?>
|
316 |
-
|
317 |
-
|
318 |
-
<?php // RENDER SITEMAP POSTS ?>
|
319 |
-
|
320 |
-
<?php if ( isset( $opt['chk_show_posts'] ) && $opt['chk_show_posts'] ) : ?>
|
321 |
-
|
322 |
-
<div id="ss_posts">
|
323 |
-
<h2 class='post_heading'><?php _e( 'Posts', 'simple-sitemap' ); ?></h2>
|
324 |
-
|
325 |
-
<?php
|
326 |
-
if ( strpos( $post_params, 'category' ) !== false ) {
|
327 |
-
$categories = get_categories();
|
328 |
-
foreach ( $categories as $category ) {
|
329 |
-
$category_link = get_category_link( $category->term_id );
|
330 |
-
$cat_count = $category->category_count;
|
331 |
-
|
332 |
-
echo '<div class="ss_cat_header"><a href="' . $category_link . '">' . ucwords( $category->cat_name ) . '</a> ';
|
333 |
-
query_posts( 'posts_per_page=-1&post_status=publish&cat=' . $category->term_id ); // show the sorted posts
|
334 |
-
?>
|
335 |
-
<?php
|
336 |
-
global $wp_query;
|
337 |
-
echo '(' . $wp_query->post_count . ')</div>'; ?>
|
338 |
-
<?php
|
339 |
-
if ( have_posts() ) :
|
340 |
-
echo '<div class="post_item_list"><ul class="post_item_list">';
|
341 |
-
while ( have_posts() ) :
|
342 |
-
the_post(); ?>
|
343 |
-
<li class="post_item">
|
344 |
-
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
|
345 |
-
</li>
|
346 |
-
<?php endwhile;
|
347 |
-
echo '</ul></div>';
|
348 |
-
endif;
|
349 |
-
wp_reset_query();
|
350 |
}
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
<?php
|
358 |
-
global $wp_query;
|
359 |
-
echo '(' . $wp_query->post_count . ')'; ?>
|
360 |
-
<?php
|
361 |
-
if ( have_posts() ) :
|
362 |
-
echo '<div class="post_item_list"><ul class="post_item_list">';
|
363 |
-
while ( have_posts() ) :
|
364 |
-
the_post(); ?>
|
365 |
-
<li class="post_item">
|
366 |
-
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
|
367 |
-
</li>
|
368 |
-
<?php endwhile;
|
369 |
-
echo '</ul></div>';
|
370 |
-
endif;
|
371 |
-
wp_reset_query();
|
372 |
-
}
|
373 |
-
} else if ( strpos( $post_params, 'tags' ) !== false ) {
|
374 |
-
$post_tags = get_tags();
|
375 |
-
echo '<div class="ss_tag_header">';
|
376 |
-
foreach ( $post_tags as $tag ) {
|
377 |
-
$tag_link = get_tag_link( $tag->term_id );
|
378 |
-
echo "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
|
379 |
-
echo "{$tag->name}</a> ($tag->count)";
|
380 |
-
|
381 |
-
query_posts( 'posts_per_page=-1&post_status=publish&tag=' . $tag->slug ); // show posts
|
382 |
-
?>
|
383 |
-
<?php
|
384 |
-
if ( have_posts() ) :
|
385 |
-
echo '<div class="post_item_list"><ul class="post_item_list">';
|
386 |
-
while ( have_posts() ) :
|
387 |
-
the_post(); ?>
|
388 |
-
<li class="post_item">
|
389 |
-
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
|
390 |
-
</li>
|
391 |
-
<?php endwhile;
|
392 |
-
echo '</ul></div>';
|
393 |
-
endif;
|
394 |
-
wp_reset_query();
|
395 |
-
}
|
396 |
-
echo '</div>';
|
397 |
-
} else {
|
398 |
-
if ( strpos( $post_params, 'date' ) !== false ) {
|
399 |
-
?>
|
400 |
-
<div class="ss_date_header">
|
401 |
-
<?php
|
402 |
-
global $wpdb;
|
403 |
-
$months = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = %s and post_date <= now( ) and post_type = %s GROUP BY month, year ORDER BY post_date DESC", 'publish', 'post' ) );
|
404 |
-
foreach ( $months as $curr_month ) {
|
405 |
-
query_posts( 'posts_per_page=-1&post_status=publish&monthnum=' . $curr_month->month . '&year=' . $curr_month->year ); // show posts
|
406 |
-
?>
|
407 |
-
<?php
|
408 |
-
global $wp_query;
|
409 |
-
echo "<a href=\"";
|
410 |
-
echo get_month_link( $curr_month->year, $curr_month->month );
|
411 |
-
echo '">' . date( 'F', mktime( 0, 0, 0, $curr_month->month ) ) . ' ' . $curr_month->year . '</a> (' . $wp_query->post_count . ')'; ?>
|
412 |
-
<?php
|
413 |
-
if ( have_posts() ) :
|
414 |
-
echo '<div class="post_item_list"><ul class="post_item_list">';
|
415 |
-
while ( have_posts() ) :
|
416 |
-
the_post(); ?>
|
417 |
-
<li class="post_item">
|
418 |
-
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
|
419 |
-
</li>
|
420 |
-
<?php endwhile;
|
421 |
-
echo '</ul></div>';
|
422 |
-
endif;
|
423 |
-
wp_reset_query();
|
424 |
-
} ?>
|
425 |
-
</div>
|
426 |
-
<?php
|
427 |
-
} else { /* default = title */
|
428 |
-
?>
|
429 |
-
<?php query_posts( $post_args ); /* Show sorted posts with default $post_args. */
|
430 |
-
if ( have_posts() ) :
|
431 |
-
echo '<ul class="post_item_list">';
|
432 |
-
while ( have_posts() ) :
|
433 |
-
the_post();
|
434 |
-
$sticky = "";
|
435 |
-
if ( is_sticky( get_the_ID() ) ) {
|
436 |
-
$sticky = " (sticky post)";
|
437 |
-
} ?>
|
438 |
-
<li class="post_item">
|
439 |
-
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
|
440 |
-
<?php if ( $sticky == ' (sticky post)' ) : ?>
|
441 |
-
<span class="ss_sticky"><?php echo $sticky; ?></span>
|
442 |
-
<?php endif; ?>
|
443 |
-
</li>
|
444 |
-
<?php endwhile;
|
445 |
-
echo '</ul>';
|
446 |
-
endif;
|
447 |
-
wp_reset_query();
|
448 |
}
|
449 |
-
}
|
450 |
-
?>
|
451 |
-
</div><!--ss_posts-->
|
452 |
|
453 |
-
|
|
|
454 |
|
|
|
|
|
|
|
|
|
|
|
455 |
|
456 |
-
|
457 |
|
458 |
-
|
459 |
-
$args = array( 'public' => true, '_builtin' => false );
|
460 |
-
$custom_post_types = get_post_types( $args, 'objects' );
|
461 |
|
462 |
-
|
463 |
-
|
464 |
|
465 |
-
|
466 |
|
467 |
-
|
468 |
|
469 |
-
|
470 |
|
471 |
-
|
472 |
|
473 |
-
|
|
|
|
|
474 |
|
475 |
-
|
476 |
-
|
477 |
-
<?php foreach ( $cpt_posts as $cpt_post ) : ?>
|
478 |
-
<?php $cpt_link = get_post_permalink( $cpt_post->ID ); ?>
|
479 |
-
<li><a href="<?php echo $cpt_link; ?>"> <?php echo $cpt_post->post_title; ?></a></li>
|
480 |
-
<?php endforeach; ?>
|
481 |
-
</ul>
|
482 |
-
<?php endif; ?>
|
483 |
-
</div><!--ss_cpt -->
|
484 |
-
|
485 |
-
<?php endif; ?>
|
486 |
|
487 |
-
|
|
|
488 |
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
|
492 |
-
|
493 |
-
|
494 |
|
495 |
-
|
|
|
|
|
496 |
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
|
499 |
// Display a Settings link on the main Plugins page
|
3 |
Plugin Name: Simple Sitemap
|
4 |
Plugin URI: http://wordpress.org/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.8
|
7 |
Author: David Gwyer
|
8 |
Author URI: http://www.wpgothemes.com
|
9 |
Text Domain: simple-sitemap
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/* wpss_ prefix is derived from [W]ord[P]ress [s]imple [s]itemap. */
|
|
|
30 |
|
31 |
+
add_shortcode( 'simple-sitemap', 'wpss_render_sitemap' );
|
|
|
32 |
add_action( 'admin_init', 'wpss_init' );
|
33 |
add_action( 'admin_menu', 'wpss_add_options_page' );
|
34 |
add_filter( 'plugin_action_links', 'wpss_plugin_action_links', 10, 2 );
|
35 |
add_filter( 'widget_text', 'do_shortcode' ); // make sitemap shortcode work in text widgets
|
36 |
add_action( 'plugins_loaded', 'wpss_localize_plugin' );
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/* Init plugin options to white list our options. */
|
39 |
function wpss_init() {
|
|
|
40 |
register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' );
|
41 |
}
|
42 |
|
51 |
<div class="wrap">
|
52 |
<h2><?php _e( 'Simple Sitemap Options', 'simple-sitemap' ); ?></h2>
|
53 |
|
54 |
+
<p><?php _e( 'From version 1.8 the Simple Sitemap plugin has been rewritten to provide much more flexibility. You now have access to a range of shortcode attributes to customize how the sitemap renders.', 'simple-sitemap' ); ?></p>
|
55 |
+
|
56 |
+
<p><?php _e( 'You can still use the plain version of the shortcode as shown below and it will out put a full sitemap.', 'simple-sitemap' ); ?></p>
|
57 |
+
|
58 |
<div style="background:#fff;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">
|
59 |
+
<?php printf( __( 'To display the Simple Sitemap on a post, page, or sidebar (via a Text widget), enter the following shortcode:<br><br>', 'simple-sitemap' ) ); ?> <code>[simple-sitemap]</code><br><br>
|
60 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
<h2><?php _e( 'Choose the Post Types to Display', 'simple-sitemap' ); ?></h2>
|
63 |
|
64 |
+
<p><?php _e( 'You now have full control over what post types are displayed as well as the order they are rendered.', 'simple-sitemap' ); ?></p>
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
<div style="background:#fff;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">
|
67 |
+
<?php printf( __( 'Specify post types and order.<br>', 'simple-sitemap' ) ); ?>
|
68 |
+
<br><code>e.g. [simple-sitemap types="post, page, testimonial, download"]</code><br><br>
|
69 |
+
<b>default: types="post, page"</b>
|
70 |
+
<br><br><?php printf( __( 'Choose from any of the following registered post types currently available:<br><br>', 'simple-sitemap' ) ); ?>
|
71 |
+
<?php
|
72 |
+
$registered_post_types = get_post_types();
|
73 |
+
$registered_post_types_str = implode(', ', $registered_post_types);
|
74 |
+
echo '<code>' . $registered_post_types_str . '</code><br><br>';
|
75 |
+
?>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<h2><?php _e( 'Formatting the Sitemap Output', 'simple-sitemap' ); ?></h2>
|
79 |
+
|
80 |
+
<p><?php _e( 'You have various options for controlling how your sitemap displays.', 'simple-sitemap' ); ?></p>
|
81 |
+
|
82 |
+
<div style="background:#fff;border: 1px dashed #ccc;font-size: 13px;margin: 20px 0 10px 0;padding: 5px 0 5px 8px;">
|
83 |
+
<?php printf( __( 'Show a heading label for each post type as well as display a list of links or plain text. If you are outputting pages then you can also control page depth too (for page hierarchies).<br>', 'simple-sitemap' ) ); ?>
|
84 |
+
<br>For the "order" attribute specify "asc" for ascending, and "desc" for descending post sort order. As for the "orderby" attribute you can filter posts by "title", "date", "author", "ID". The "exclude" attribute simply takes a comma separated list of post IDs.
|
85 |
+
<br><br><code>e.g. [simple-sitemap show_label="true" links="true" page_depth="1" order="asc" orderby="title" exclude="1,2,3"]</code>
|
86 |
+
<br><br><b>defaults:<br>
|
87 |
+
show_label="true"<br>
|
88 |
+
links="true"<br>
|
89 |
+
page_depth="0"<br>
|
90 |
+
order="asc"<br>
|
91 |
+
orderby="title"<br>
|
92 |
+
exclude=""<br><br></b>
|
93 |
+
</div>
|
94 |
|
95 |
<div style="clear:both;">
|
96 |
<p>
|
100 |
</p>
|
101 |
</div>
|
102 |
|
103 |
+
<?php
|
104 |
+
$discount_date = "14th August 2014";
|
105 |
+
if( strtotime($discount_date) > strtotime('now') ) {
|
106 |
+
echo '<p style="background: #fff;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'For a limited time only! <strong>Get 50% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>MINN50OFF</code>', 'simple-sitemap' ) . '</p>';
|
107 |
+
} else {
|
108 |
+
echo '<p style="background: #eee;border: 1px dashed #ccc;font-size: 13px;margin: 0 0 10px 0;padding: 5px 0 5px 8px;">' . __( 'As a user of our free plugins here\'s a bonus just for you! <strong>Get 30% OFF</strong> the price of our brand new mobile ready, fully responsive <a href="http://www.wpgothemes.com/themes/minn/" target="_blank"><strong>Minn WordPress theme</strong></a>. Simply enter the following code at checkout: <code>WPGO30OFF</code>', 'simple-sitemap' ) . '</p>';
|
109 |
+
}
|
110 |
+
?>
|
111 |
+
|
112 |
</div>
|
113 |
<?php
|
114 |
}
|
115 |
|
116 |
/* Shortcode function. */
|
117 |
+
function wpss_render_sitemap($args) {
|
118 |
+
|
119 |
+
/* Get slider attributes from the shortcode. */
|
120 |
+
extract( shortcode_atts( array(
|
121 |
+
'types' => 'post, page',
|
122 |
+
'show_excerpt' => 'false',
|
123 |
+
'title_tag' => '',
|
124 |
+
'excerpt_tag' => 'div',
|
125 |
+
'post_type_tag' => 'h2',
|
126 |
+
'show_label' => 'true',
|
127 |
+
'links' => 'true',
|
128 |
+
'page_depth' => 0,
|
129 |
+
'order' => 'asc',
|
130 |
+
'orderby' => 'title',
|
131 |
+
'exclude' => ''
|
132 |
+
), $args ) );
|
133 |
+
|
134 |
+
$post_types = $types; // allows the use of the shorter 'types' rather than 'post_types' in the shortcode
|
135 |
+
|
136 |
+
// Start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post
|
137 |
+
ob_start();
|
138 |
+
|
139 |
+
// *************
|
140 |
+
// CONTENT START
|
141 |
+
// *************
|
142 |
+
|
143 |
+
$post_types = array_map( 'trim', explode( ',', $post_types ) ); // convert comma separated string to array
|
144 |
+
$exclude = array_map( 'trim', explode( ',', $exclude) ); // must be array to work in the post query
|
145 |
+
$registered_post_types = get_post_types();
|
146 |
+
|
147 |
+
//echo "<pre>";
|
148 |
+
//print_r($registered_post_types);
|
149 |
+
//print_r($post_types);
|
150 |
+
//print_r($exclude);
|
151 |
+
//echo "</pre>";
|
152 |
+
|
153 |
+
foreach( $post_types as $post_type ) :
|
154 |
+
|
155 |
+
// generate <ul> element class
|
156 |
+
$ul_class = 'simple-sitemap-' . $post_type;
|
157 |
+
|
158 |
+
// bail if post type isn't valid
|
159 |
+
if( !array_key_exists( $post_type, $registered_post_types ) ) {
|
160 |
+
break;
|
161 |
}
|
|
|
162 |
|
163 |
+
// set opening and closing title tag
|
164 |
+
if( !empty($title_tag) ) {
|
165 |
+
$title_open = '<' . $title_tag . '>';
|
166 |
+
$title_close = '</' . $title_tag . '>';
|
167 |
+
}
|
168 |
+
else {
|
169 |
+
$title_open = $title_close = '';
|
170 |
+
}
|
171 |
|
172 |
+
// conditionally show label for each post type
|
173 |
+
if( $show_label == 'true' ) {
|
174 |
+
$post_type_obj = get_post_type_object( $post_type );
|
175 |
+
$post_type_name = $post_type_obj->labels->name;
|
176 |
+
echo '<' . $post_type_tag . '>' . $post_type_name . '</' . $post_type_tag . '>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
|
|
178 |
|
179 |
+
$query_args = array(
|
180 |
+
'posts_per_page' => -1,
|
181 |
+
'post_type' => $post_type,
|
182 |
+
'order' => $order,
|
183 |
+
'orderby' => $orderby,
|
184 |
+
'post__not_in' => $exclude
|
185 |
+
);
|
186 |
|
187 |
+
// use custom rendering for 'page' post type to properly render sub pages
|
188 |
+
if( $post_type == 'page' ) {
|
189 |
+
$arr = array(
|
190 |
+
'title_tag' => $title_tag,
|
191 |
+
'links' => $links,
|
192 |
+
'title_open' => $title_open,
|
193 |
+
'title_close' => $title_close,
|
194 |
+
'page_depth' => $page_depth,
|
195 |
+
'exclude' => $exclude
|
196 |
+
);
|
197 |
+
echo '<ul class="' . $ul_class . '">';
|
198 |
+
wpss_list_pages($arr, $query_args);
|
199 |
+
echo '</ul>';
|
200 |
+
continue;
|
201 |
+
}
|
202 |
|
203 |
+
//post query
|
204 |
+
$sitemap_query = new WP_Query( $query_args );
|
205 |
|
206 |
+
if ( $sitemap_query->have_posts() ) :
|
207 |
|
208 |
+
echo '<ul class="' . $ul_class . '">';
|
209 |
|
210 |
+
// start of the loop
|
211 |
+
while ( $sitemap_query->have_posts() ) : $sitemap_query->the_post();
|
212 |
|
213 |
+
// title
|
214 |
+
$title_text = get_the_title();
|
215 |
|
216 |
+
if( !empty( $title_text ) ) {
|
217 |
+
if ( $links == 'true' ) {
|
218 |
+
$title = $title_open . '<a href="' . get_post_permalink() . '">' . $title_text . '</a>' . $title_close;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
} else {
|
220 |
+
$title = $title_open . $title_text . $title_close;
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
+
else {
|
224 |
+
if ( $links == 'true' ) {
|
225 |
+
$title = $title_open . '<a href="' . get_post_permalink() . '">' . '(no title)' . '</a>' . $title_close;
|
226 |
+
} else {
|
227 |
+
$title = $title_open . '(no title)' . $title_close;
|
228 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
|
|
|
|
|
|
230 |
|
231 |
+
// excerpt
|
232 |
+
$excerpt = $show_excerpt == 'true' ? '<' . $excerpt_tag . '>' . get_the_excerpt() . '</' . $excerpt_tag . '>' : '';
|
233 |
|
234 |
+
// render list item
|
235 |
+
echo '<li>';
|
236 |
+
echo $title;
|
237 |
+
echo $excerpt;
|
238 |
+
echo '</li>';
|
239 |
|
240 |
+
endwhile; // end of post loop -->
|
241 |
|
242 |
+
echo '</ul>';
|
|
|
|
|
243 |
|
244 |
+
// put pagination functions here
|
245 |
+
wp_reset_postdata();
|
246 |
|
247 |
+
else:
|
248 |
|
249 |
+
echo '<p>' . __( 'Sorry, no posts matched your criteria.', 'wpgo-simple-sitemap-pro' ) . '</p>';
|
250 |
|
251 |
+
endif;
|
252 |
|
253 |
+
endforeach;
|
254 |
|
255 |
+
// ***********
|
256 |
+
// CONTENT END
|
257 |
+
// ***********
|
258 |
|
259 |
+
$sitemap = ob_get_contents();;
|
260 |
+
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
+
return $sitemap;
|
263 |
+
}
|
264 |
|
265 |
+
function wpss_list_pages( $arr, $query_args ) {
|
266 |
+
|
267 |
+
$map_args = array(
|
268 |
+
'title' => 'post_title',
|
269 |
+
'date' => 'post_date',
|
270 |
+
'author' => 'post_author',
|
271 |
+
'modified' => 'post_modified'
|
272 |
+
);
|
273 |
+
|
274 |
+
// modify the query args for get_pages() if necessary
|
275 |
+
$orderby = array_key_exists( $query_args['orderby'], $map_args ) ? $map_args[$query_args['orderby']] : $query_args['orderby'];
|
276 |
+
|
277 |
+
$r = array(
|
278 |
+
'depth' => $arr['page_depth'],
|
279 |
+
'show_date' => '',
|
280 |
+
'date_format' => get_option( 'date_format' ),
|
281 |
+
'child_of' => 0,
|
282 |
+
'exclude' => $arr['exclude'],
|
283 |
+
'echo' => 1,
|
284 |
+
'authors' => '',
|
285 |
+
'sort_column' => $orderby,
|
286 |
+
'sort_order' => $query_args['order'],
|
287 |
+
'link_before' => '',
|
288 |
+
'link_after' => '',
|
289 |
+
'walker' => '',
|
290 |
+
);
|
291 |
+
|
292 |
+
$output = '';
|
293 |
+
$current_page = 0;
|
294 |
+
$r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] ); // sanitize, mostly to keep spaces out
|
295 |
+
|
296 |
+
// Query pages.
|
297 |
+
$r['hierarchical'] = 0;
|
298 |
+
$pages = get_pages( $r );
|
299 |
+
|
300 |
+
if ( ! empty( $pages ) ) {
|
301 |
+
global $wp_query;
|
302 |
+
if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
|
303 |
+
$current_page = get_queried_object_id();
|
304 |
+
} elseif ( is_singular() ) {
|
305 |
+
$queried_object = get_queried_object();
|
306 |
+
if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
|
307 |
+
$current_page = $queried_object->ID;
|
308 |
+
}
|
309 |
+
}
|
310 |
|
311 |
+
$output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
|
312 |
+
}
|
313 |
|
314 |
+
// remove links
|
315 |
+
if( $arr['links'] != 'true' )
|
316 |
+
$output = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", $output);
|
317 |
|
318 |
+
if ( $r['echo'] ) {
|
319 |
+
echo $output;
|
320 |
+
} else {
|
321 |
+
return $output;
|
322 |
+
}
|
323 |
}
|
324 |
|
325 |
// Display a Settings link on the main Plugins page
|