Sitemap - Version 1.1.0

Version Description

  • Added "child_of=current" option;
  • Improving documentation;
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin Sitemap
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.0 to 1.1.0

Files changed (2) hide show
  1. readme.txt +16 -5
  2. sitemap.php +10 -3
readme.txt CHANGED
@@ -6,19 +6,30 @@ Tags: page, sitemap
6
  Author URI: http://web-profile.com.ua/wordpress/
7
  Requires at least: 3.0
8
  Tested up to: 3.1.1
9
- Stable tag: 1.0.0
10
 
11
- "Sitemap" plugin helps you show sitemap of your site (tree of pages) with [sitemap] shortcode.
12
 
13
  == Description ==
14
 
15
- You can use aditional parameters: [sitemap depth="2" child_of="4" exclude="6,7,8"].
16
 
17
- Plugin is based on [wp_list_pages('sort_column=menu_order&title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) WordPress function;
 
 
 
 
 
 
 
 
18
 
19
  [WordPress stuff](http://web-profile.com.ua/wordpress/)
20
 
21
  == Changelog ==
 
 
 
22
 
23
  = 1.0.0 =
24
  * Initial release;
@@ -26,4 +37,4 @@ Plugin is based on [wp_list_pages('sort_column=menu_order&title_li=')](http://co
26
  == Installation ==
27
 
28
  1. Install plugin and activate it on the Plugins page;
29
- 2. Add shortcode [sitemap] to page content;
6
  Author URI: http://web-profile.com.ua/wordpress/
7
  Requires at least: 3.0
8
  Tested up to: 3.1.1
9
+ Stable tag: 1.1.0
10
 
11
+ "Sitemap" plugin helps you show sitemap of your web-site (hierarchical tree of pages) with [sitemap] shortcode.
12
 
13
  == Description ==
14
 
15
+ You can use aditional parameters: **`[sitemap depth="2" child_of="4" exclude="6,7,8"]`**.
16
 
17
+ Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/).
18
+
19
+ Plugin is based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) function;
20
+ = Usage: =
21
+ * the depth (how many levels in the hierarchy of pages are to be included in the list) by default is unlimited, but you can specify it like this: `[sitemap depth="3"]`;
22
+ * if you want to show flat list of pages (not hierarchical tree) you can use this shortcode: `[sitemap depth="-1"]`;
23
+ * if you want to show subpages of the specific page you can use this shortcode: `[sitemap child_of="4"]` where `4` is the ID of the specific page;
24
+ * if you want to show subpages of the current page you can use this shortcode: `[sitemap child_of="current"]` or `[sitemap child_of="this"]`;
25
+ * if you want to exclude some pages from the list you can use this shortcode: `[sitemap exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs;
26
 
27
  [WordPress stuff](http://web-profile.com.ua/wordpress/)
28
 
29
  == Changelog ==
30
+ = 1.1.0 =
31
+ * Added "child_of=current" option;
32
+ * Improving documentation;
33
 
34
  = 1.0.0 =
35
  * Initial release;
37
  == Installation ==
38
 
39
  1. Install plugin and activate it on the Plugins page;
40
+ 2. Add shortcode **`[sitemap]`** to page content;
sitemap.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/sitemap/
5
  Description: Show sitemap with [sitemap] shortcode.
6
- Version: 1.0.0
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/
@@ -15,8 +15,11 @@ function sitemap_shortcode( $atts ) {
15
  'child_of' => '0',
16
  'exclude' => '0'
17
  ), $atts ) );
18
-
19
  $return = '';
 
 
 
20
  $list_pages_args = array(
21
  'depth' => $depth,
22
  'show_date' => '',
@@ -34,7 +37,11 @@ function sitemap_shortcode( $atts ) {
34
 
35
  $list_pages = wp_list_pages( $list_pages_args );
36
 
37
- $return = '<ul>'.$list_pages.'</ul>';
 
 
 
 
38
 
39
  return $return;
40
  }
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/sitemap/
5
  Description: Show sitemap with [sitemap] shortcode.
6
+ Version: 1.1.0
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/
15
  'child_of' => '0',
16
  'exclude' => '0'
17
  ), $atts ) );
18
+ global $post;
19
  $return = '';
20
+ if( $child_of == 'current' || $child_of == 'this' ){
21
+ $child_of = $post->ID;
22
+ }
23
  $list_pages_args = array(
24
  'depth' => $depth,
25
  'show_date' => '',
37
 
38
  $list_pages = wp_list_pages( $list_pages_args );
39
 
40
+ if ($list_pages) {
41
+ $return = '<ul>'.$list_pages.'</ul>';
42
+ }else{
43
+ $return = '';
44
+ }
45
 
46
  return $return;
47
  }