Sitemap - Version 1.9

Version Description

  • Added show_child_count parameter;
  • Added show_meta_key parameter;
Download this release

Release Info

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

Code changes from version 1.8 to 1.9

Files changed (4) hide show
  1. readme.txt +19 -16
  2. screenshot-1.png +0 -0
  3. screenshot-2.png +0 -0
  4. sitemap.php +42 -10
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: page, page-list, pagelist, sitemap, subpages, siblings
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
- Stable tag: 1.8
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -15,29 +15,24 @@ Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/)
15
 
16
  You can use aditional parameters: `[pagelist depth="2" child_of="4" exclude="6,7,8"]`.
17
 
18
- Plugin is based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) and
19
- Shortcode [pagelist_ext] is based on functions;
 
 
 
 
 
20
  = Examples: =
21
  * show hierarchical tree of pages: `[pagelist]`;
22
  * show hierarchical tree of subpages: `[subpages]`;
23
  * show hierarchical tree of sibling pages: `[siblings]`;
24
  * show list of pages with featured image and with excerpt: `[pagelist_ext]`;
25
 
26
- [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
27
 
28
  [CMS WordPress](http://web-profile.com.ua/wordpress/)
29
 
30
- == Other Notes ==
31
-
32
- = Documentation =
33
-
34
- Shortcodes [pagelist], [subpages], [siblings] are based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) function and show hierarchical tree of pages;
35
- You can use aditional parameters: **`[pagelist depth="2" child_of="4" exclude="6,7,8"]`**.
36
- Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The only difference is that [subpages] and [siblings] not accept `child_of` parameter, because [subpages] shows subpages to the current page and [siblings] shows subpages to the parent page.
37
-
38
- Shortcode [pagelist_ext] is based on [get_pages()](http://codex.wordpress.org/Function_Reference/get_pages) function and show list of pages with featured image and with excerpt;
39
- You can use aditional parameters: **`[pagelist child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`**.
40
- Shortcode [pagelist_ext] accept the same parameters.
41
 
42
  = Parameters for [pagelist], [subpages] and [siblings]: =
43
  * **depth** - means how many levels in the hierarchy of pages are to be included in the list, by default depth is unlimited (depth=0), but you can specify it like this: `[pagelist depth="3"]`; If you want to show flat list of pages (not hierarchical tree) you can use this shortcode: `[pagelist depth="-1"]`;
@@ -79,6 +74,10 @@ Shortcode [pagelist_ext] accept the same parameters.
79
  * **post_status** - `[pagelist_ext post_status="publish"]`;
80
  * **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
81
  * **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
 
 
 
 
82
 
83
  == Screenshots ==
84
 
@@ -87,6 +86,10 @@ Shortcode [pagelist_ext] accept the same parameters.
87
 
88
  == Changelog ==
89
 
 
 
 
 
90
  = 1.8 =
91
  * Added screenshots;
92
  * Improved parameter parsing;
@@ -116,4 +119,4 @@ Shortcode [pagelist_ext] accept the same parameters.
116
  == Installation ==
117
 
118
  1. Install plugin and activate it on the Plugins page;
119
- 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
+ Stable tag: 1.9
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
15
 
16
  You can use aditional parameters: `[pagelist depth="2" child_of="4" exclude="6,7,8"]`.
17
 
18
+ Shortcodes [pagelist], [subpages], [siblings] are based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) function and show hierarchical tree of pages;
19
+ You can use aditional parameters: **`[pagelist depth="2" child_of="4" exclude="6,7,8"]`**.
20
+ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The only difference is that [subpages] and [siblings] not accept `child_of` parameter, because [subpages] shows subpages to the current page and [siblings] shows subpages to the parent page.
21
+
22
+ Shortcode [pagelist_ext] is based on [get_pages()](http://codex.wordpress.org/Function_Reference/get_pages) function and show list of pages with featured image and with excerpt;
23
+ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`**.
24
+
25
  = Examples: =
26
  * show hierarchical tree of pages: `[pagelist]`;
27
  * show hierarchical tree of subpages: `[subpages]`;
28
  * show hierarchical tree of sibling pages: `[siblings]`;
29
  * show list of pages with featured image and with excerpt: `[pagelist_ext]`;
30
 
31
+ [Sitemap plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
32
 
33
  [CMS WordPress](http://web-profile.com.ua/wordpress/)
34
 
35
+ == Usage ==
 
 
 
 
 
 
 
 
 
 
36
 
37
  = Parameters for [pagelist], [subpages] and [siblings]: =
38
  * **depth** - means how many levels in the hierarchy of pages are to be included in the list, by default depth is unlimited (depth=0), but you can specify it like this: `[pagelist depth="3"]`; If you want to show flat list of pages (not hierarchical tree) you can use this shortcode: `[pagelist depth="-1"]`;
74
  * **post_status** - `[pagelist_ext post_status="publish"]`;
75
  * **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
76
  * **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
77
+ * **show_child_count** - if you want to show child count you can use this shortcode: `[pagelist_ext show_child_count="1"]`; by default the child_count is disabled (show_child_count="0"); If show_child_count="1", but count of subpages=0, than child count is not showing;
78
+ * **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
79
+ * **show_meta_key** - if you want to show meta key you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key"]`; by default the show_meta_key is empty (show_meta_key=""); If show_meta_key is enabled, but meta_value is empty, than meta_key is not showing;
80
+ * **meta_template** - if you want to specify the template of meta you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key" meta_template="Meta: %meta%"]`; by default meta_template="%meta%";
81
 
82
  == Screenshots ==
83
 
86
 
87
  == Changelog ==
88
 
89
+ = 1.9 =
90
+ * Added show_child_count parameter;
91
+ * Added show_meta_key parameter;
92
+
93
  = 1.8 =
94
  * Added screenshots;
95
  * Improved parameter parsing;
119
  == Installation ==
120
 
121
  1. Install plugin and activate it on the Plugins page;
122
+ 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
sitemap.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
5
  Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
6
- Version: 1.8
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -16,7 +16,7 @@ Future features:
16
 
17
  add_action('wp_print_styles', 'page_list_add_stylesheet');
18
  function page_list_add_stylesheet() {
19
- wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '1.8', 'all' );
20
  }
21
 
22
  if ( !function_exists('pagelist_norm_params') ) {
@@ -78,7 +78,7 @@ if ( !function_exists('pagelist_shortcode') ) {
78
  $list_pages = wp_list_pages( $page_list_args );
79
 
80
  if ($list_pages) {
81
- $return = "\n".'<!-- powered by Page-list plugin ver.1.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
82
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
83
  }else{
84
  $return = '';
@@ -138,7 +138,7 @@ if ( !function_exists('subpages_shortcode') ) {
138
  $list_pages = wp_list_pages( $page_list_args );
139
 
140
  if ($list_pages) {
141
- $return = "\n".'<!-- powered by Page-list plugin ver.1.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
142
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
143
  }else{
144
  $return = '';
@@ -202,7 +202,7 @@ if ( !function_exists('siblings_shortcode') ) {
202
  $list_pages = wp_list_pages( $page_list_args );
203
 
204
  if ($list_pages) {
205
- $return = "\n".'<!-- powered by Page-list plugin ver.1.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
206
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
207
  }else{
208
  $return = '';
@@ -239,7 +239,11 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
239
  'post_type' => 'page',
240
  'post_status' => 'publish',
241
  'class' => '',
242
- 'strip_tags' => 1
 
 
 
 
243
  ), $atts ) );
244
 
245
  if( $child_of == '0' ){
@@ -269,7 +273,11 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
269
  'post_type' => $post_type,
270
  'post_status' => $post_status,
271
  'class' => $class,
272
- 'strip_tags' => $strip_tags
 
 
 
 
273
  );
274
  $list_pages = get_pages( $page_list_ext_args );
275
  $list_pages_html = '';
@@ -290,14 +298,38 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
290
  //$content = apply_filters('the_content', $page->post_content);
291
  //$content = str_replace(']]>', ']]&gt;', $content);
292
  $content = page_list_parse_content( $page->post_content, $limit_content, $strip_tags );
293
-
294
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
295
  }
296
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  $list_pages_html .= '</div>'."\n";
298
  }
299
  if ($list_pages_html) {
300
- $return = "\n".'<!-- powered by Page-list plugin ver.1.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
301
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
302
  }else{
303
  $return = '';
3
  Plugin Name: Sitemap
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
5
  Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
6
+ Version: 1.9
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
16
 
17
  add_action('wp_print_styles', 'page_list_add_stylesheet');
18
  function page_list_add_stylesheet() {
19
+ wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '1.9', 'all' );
20
  }
21
 
22
  if ( !function_exists('pagelist_norm_params') ) {
78
  $list_pages = wp_list_pages( $page_list_args );
79
 
80
  if ($list_pages) {
81
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.9 (wordpress.org/extend/plugins/page-list/) -->'."\n";
82
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
83
  }else{
84
  $return = '';
138
  $list_pages = wp_list_pages( $page_list_args );
139
 
140
  if ($list_pages) {
141
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.9 (wordpress.org/extend/plugins/page-list/) -->'."\n";
142
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
143
  }else{
144
  $return = '';
202
  $list_pages = wp_list_pages( $page_list_args );
203
 
204
  if ($list_pages) {
205
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.9 (wordpress.org/extend/plugins/page-list/) -->'."\n";
206
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
207
  }else{
208
  $return = '';
239
  'post_type' => 'page',
240
  'post_status' => 'publish',
241
  'class' => '',
242
+ 'strip_tags' => 1,
243
+ 'show_child_count' => 0,
244
+ 'child_count_template' => 'Subpages: %child_count%',
245
+ 'show_meta_key' => '',
246
+ 'meta_template' => '%meta%'
247
  ), $atts ) );
248
 
249
  if( $child_of == '0' ){
273
  'post_type' => $post_type,
274
  'post_status' => $post_status,
275
  'class' => $class,
276
+ 'strip_tags' => $strip_tags,
277
+ 'show_child_count' => $show_child_count,
278
+ 'child_count_template' => $child_count_template,
279
+ 'show_meta_key' => $show_meta_key,
280
+ 'meta_template' => $meta_template
281
  );
282
  $list_pages = get_pages( $page_list_ext_args );
283
  $list_pages_html = '';
298
  //$content = apply_filters('the_content', $page->post_content);
299
  //$content = str_replace(']]>', ']]&gt;', $content);
300
  $content = page_list_parse_content( $page->post_content, $limit_content, $strip_tags );
 
301
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
302
  }
303
+ if( $show_child_count == 1 ){
304
+ $count_subpages = count(get_pages("child_of=".$page->ID));
305
+ if( $count_subpages > 0 ){ // hide empty
306
+ $child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
307
+ if($child_count_pos === false) { // %child_count% not found in template
308
+ $child_count_template_html = $child_count_template.' '.$count_subpages;
309
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
310
+ } else { // %child_count% found in template
311
+ $child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
312
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
313
+ }
314
+ }
315
+ }
316
+ if( $show_meta_key != '' ){
317
+ $post_meta = get_post_meta($page->ID, $show_meta_key, true);
318
+ if( !empty($post_meta) ){ // hide empty
319
+ $meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
320
+ if($meta_pos === false) { // %meta% not found in template
321
+ $meta_template_html = $meta_template.' '.$post_meta;
322
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
323
+ } else { // %meta% found in template
324
+ $meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
325
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
326
+ }
327
+ }
328
+ }
329
  $list_pages_html .= '</div>'."\n";
330
  }
331
  if ($list_pages_html) {
332
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.9 (wordpress.org/extend/plugins/page-list/) -->'."\n";
333
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
334
  }else{
335
  $return = '';