Page-list - 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 Page-list
Version 1.9
Comparing to
See all releases

Code changes from version 1.8 to 1.9

Files changed (4) hide show
  1. page-list.php +42 -10
  2. readme.txt +18 -15
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
page-list.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page-list
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: Page-list
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 = '';
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
  "Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -13,8 +13,13 @@ Stable tag: 1.8
13
 
14
  You can use aditional parameters: `[pagelist depth="2" child_of="4" exclude="6,7,8"]`.
15
 
16
- Plugin is based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) and
17
- Shortcode [pagelist_ext] is based on functions;
 
 
 
 
 
18
  = Examples: =
19
  * show hierarchical tree of pages: `[pagelist]`;
20
  * show hierarchical tree of subpages: `[subpages]`;
@@ -25,17 +30,7 @@ Shortcode [pagelist_ext] is based on functions;
25
 
26
  [CMS WordPress](http://web-profile.com.ua/wordpress/)
27
 
28
- == Other Notes ==
29
-
30
- = Documentation =
31
-
32
- 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;
33
- You can use aditional parameters: **`[pagelist depth="2" child_of="4" exclude="6,7,8"]`**.
34
- 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.
35
-
36
- 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;
37
- You can use aditional parameters: **`[pagelist child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`**.
38
- Shortcode [pagelist_ext] accept the same parameters.
39
 
40
  = Parameters for [pagelist], [subpages] and [siblings]: =
41
  * **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"]`;
@@ -77,6 +72,10 @@ Shortcode [pagelist_ext] accept the same parameters.
77
  * **post_status** - `[pagelist_ext post_status="publish"]`;
78
  * **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="");
79
  * **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");
 
 
 
 
80
 
81
  == Screenshots ==
82
 
@@ -85,6 +84,10 @@ Shortcode [pagelist_ext] accept the same parameters.
85
 
86
  == Changelog ==
87
 
 
 
 
 
88
  = 1.8 =
89
  * Added screenshots;
90
  * Improved parameter parsing;
@@ -114,4 +117,4 @@ Shortcode [pagelist_ext] accept the same parameters.
114
  == Installation ==
115
 
116
  1. Install plugin and activate it on the Plugins page;
117
- 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
  "Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
13
 
14
  You can use aditional parameters: `[pagelist depth="2" child_of="4" exclude="6,7,8"]`.
15
 
16
+ 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;
17
+ You can use aditional parameters: **`[pagelist depth="2" child_of="4" exclude="6,7,8"]`**.
18
+ 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.
19
+
20
+ 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;
21
+ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`**.
22
+
23
  = Examples: =
24
  * show hierarchical tree of pages: `[pagelist]`;
25
  * show hierarchical tree of subpages: `[subpages]`;
30
 
31
  [CMS WordPress](http://web-profile.com.ua/wordpress/)
32
 
33
+ == Usage ==
 
 
 
 
 
 
 
 
 
 
34
 
35
  = Parameters for [pagelist], [subpages] and [siblings]: =
36
  * **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"]`;
72
  * **post_status** - `[pagelist_ext post_status="publish"]`;
73
  * **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="");
74
  * **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");
75
+ * **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;
76
+ * **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%";
77
+ * **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;
78
+ * **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%";
79
 
80
  == Screenshots ==
81
 
84
 
85
  == Changelog ==
86
 
87
+ = 1.9 =
88
+ * Added show_child_count parameter;
89
+ * Added show_meta_key parameter;
90
+
91
  = 1.8 =
92
  * Added screenshots;
93
  * Improved parameter parsing;
117
  == Installation ==
118
 
119
  1. Install plugin and activate it on the Plugins page;
120
+ 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file