Page-list - Version 1.8

Version Description

  • Added screenshots;
  • Improved parameter parsing;
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin Page-list
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

Files changed (4) hide show
  1. page-list.php +31 -40
  2. readme.txt +12 -3
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
page-list.php CHANGED
@@ -3,13 +3,12 @@
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.7
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
10
 
11
  Future features:
12
- - add support exclude="current,5";
13
  - exclude_by_alias;
14
  - exclude_front_page;
15
  - exclude_post_page;
@@ -17,7 +16,19 @@ Future features:
17
 
18
  add_action('wp_print_styles', 'page_list_add_stylesheet');
19
  function page_list_add_stylesheet() {
20
- wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '1.7', 'all' );
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  if ( !function_exists('pagelist_shortcode') ) {
@@ -43,20 +54,10 @@ if ( !function_exists('pagelist_shortcode') ) {
43
  'class' => ''
44
  ), $atts ) );
45
 
46
- if( $child_of == 'current' || $child_of == 'this' ){
47
- $child_of = $post->ID;
48
- }
49
- if( $child_of == 'parent' ){
50
- $child_of = $post->post_parent;
51
- }
52
- if( $exclude == 'current' || $exclude == 'this' ){
53
- $exclude = $post->ID;
54
- }
55
-
56
  $page_list_args = array(
57
  'depth' => $depth,
58
- 'child_of' => $child_of,
59
- 'exclude' => $exclude,
60
  'exclude_tree' => $exclude_tree,
61
  'include' => $include,
62
  'title_li' => $title_li,
@@ -77,7 +78,7 @@ if ( !function_exists('pagelist_shortcode') ) {
77
  $list_pages = wp_list_pages( $page_list_args );
78
 
79
  if ($list_pages) {
80
- $return = "\n".'<!-- powered by Page-list plugin ver.1.7 (wordpress.org/extend/plugins/page-list/) -->'."\n";
81
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
82
  }else{
83
  $return = '';
@@ -116,7 +117,7 @@ if ( !function_exists('subpages_shortcode') ) {
116
  $page_list_args = array(
117
  'depth' => $depth,
118
  'child_of' => $post->ID,
119
- 'exclude' => $exclude,
120
  'exclude_tree' => $exclude_tree,
121
  'include' => $include,
122
  'title_li' => $title_li,
@@ -137,7 +138,7 @@ if ( !function_exists('subpages_shortcode') ) {
137
  $list_pages = wp_list_pages( $page_list_args );
138
 
139
  if ($list_pages) {
140
- $return = "\n".'<!-- powered by Page-list plugin ver.1.7 (wordpress.org/extend/plugins/page-list/) -->'."\n";
141
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
142
  }else{
143
  $return = '';
@@ -180,7 +181,7 @@ if ( !function_exists('siblings_shortcode') ) {
180
  $page_list_args = array(
181
  'depth' => $depth,
182
  'child_of' => $post->post_parent,
183
- 'exclude' => $exclude,
184
  'exclude_tree' => $exclude_tree,
185
  'include' => $include,
186
  'title_li' => $title_li,
@@ -201,7 +202,7 @@ if ( !function_exists('siblings_shortcode') ) {
201
  $list_pages = wp_list_pages( $page_list_args );
202
 
203
  if ($list_pages) {
204
- $return = "\n".'<!-- powered by Page-list plugin ver.1.7 (wordpress.org/extend/plugins/page-list/) -->'."\n";
205
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
206
  }else{
207
  $return = '';
@@ -220,8 +221,8 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
220
  'show_title' => 1,
221
  'show_content' => 1,
222
  'limit_content' => 250,
223
- 'image_width' => '40',
224
- 'image_height' => '40',
225
  'child_of' => '0',
226
  'sort_order' => 'ASC',
227
  'sort_column' => 'menu_order, post_title',
@@ -241,26 +242,22 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
241
  'strip_tags' => 1
242
  ), $atts ) );
243
 
244
- if( $child_of == 'current' || $child_of == 'this' || $child_of == '0' ){
245
  $child_of = $post->ID;
246
  }
247
 
248
- if( $exclude == 'current' || $exclude == 'this' ){
249
- $exclude = $post->ID;
250
- }
251
-
252
- $page_list_image_args = array(
253
  'show_image' => $show_image,
254
  'show_title' => $show_title,
255
  'show_content' => $show_content,
256
  'limit_content' => $limit_content,
257
  'image_width' => $image_width,
258
  'image_height' => $image_height,
259
- 'child_of' => $child_of,
260
  'sort_order' => $sort_order,
261
  'sort_column' => $sort_column,
262
  'hierarchical' => $hierarchical,
263
- 'exclude' => $exclude,
264
  'include' => $include,
265
  'meta_key' => $meta_key,
266
  'meta_value' => $meta_value,
@@ -274,7 +271,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
274
  'class' => $class,
275
  'strip_tags' => $strip_tags
276
  );
277
- $list_pages = get_pages( $page_list_image_args );
278
  $list_pages_html = '';
279
  foreach($list_pages as $page){
280
  $link = get_permalink( $page->ID );
@@ -290,8 +287,8 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
290
  $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></h3>';
291
  }
292
  if( $show_content == 1 ){
293
- $content = apply_filters('the_content', $page->post_content);
294
- $content = str_replace(']]>', ']]&gt;', $content);
295
  $content = page_list_parse_content( $page->post_content, $limit_content, $strip_tags );
296
 
297
  $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
@@ -300,7 +297,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
300
  $list_pages_html .= '</div>'."\n";
301
  }
302
  if ($list_pages_html) {
303
- $return = "\n".'<!-- powered by Page-list plugin ver.1.7 (wordpress.org/extend/plugins/page-list/) -->'."\n";
304
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
305
  }else{
306
  $return = '';
@@ -313,10 +310,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
313
 
314
  if ( !function_exists('page_list_parse_content') ) {
315
  function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1) {
316
- global $more, $preview;
317
-
318
  $output = '';
319
-
320
  if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
321
  $content = explode($matches[0], $content, 2);
322
 
@@ -341,11 +335,8 @@ if ( !function_exists('page_list_parse_content') ) {
341
  }
342
  $content = array($content);
343
  }
344
-
345
  $output .= $content[0];
346
-
347
  $output = force_balance_tags($output);
348
-
349
  return $output;
350
  }
351
  }
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/
10
 
11
  Future features:
 
12
  - exclude_by_alias;
13
  - exclude_front_page;
14
  - exclude_post_page;
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') ) {
23
+ function pagelist_norm_params( $str ) {
24
+ global $post;
25
+ $new_str = $str;
26
+ $new_str = str_replace('this', $post->ID, $new_str); // exclude this page
27
+ $new_str = str_replace('current', $post->ID, $new_str); // exclude current page
28
+ $new_str = str_replace('curent', $post->ID, $new_str); // exclude curent page with mistake
29
+ $new_str = str_replace('parent', $post->post_parent, $new_str); // exclude parent page
30
+ return $new_str;
31
+ }
32
  }
33
 
34
  if ( !function_exists('pagelist_shortcode') ) {
54
  'class' => ''
55
  ), $atts ) );
56
 
 
 
 
 
 
 
 
 
 
 
57
  $page_list_args = array(
58
  'depth' => $depth,
59
+ 'child_of' => pagelist_norm_params($child_of),
60
+ 'exclude' => pagelist_norm_params($exclude),
61
  'exclude_tree' => $exclude_tree,
62
  'include' => $include,
63
  'title_li' => $title_li,
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 = '';
117
  $page_list_args = array(
118
  'depth' => $depth,
119
  'child_of' => $post->ID,
120
+ 'exclude' => pagelist_norm_params($exclude),
121
  'exclude_tree' => $exclude_tree,
122
  'include' => $include,
123
  'title_li' => $title_li,
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 = '';
181
  $page_list_args = array(
182
  'depth' => $depth,
183
  'child_of' => $post->post_parent,
184
+ 'exclude' => pagelist_norm_params($exclude),
185
  'exclude_tree' => $exclude_tree,
186
  'include' => $include,
187
  'title_li' => $title_li,
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 = '';
221
  'show_title' => 1,
222
  'show_content' => 1,
223
  'limit_content' => 250,
224
+ 'image_width' => '50',
225
+ 'image_height' => '50',
226
  'child_of' => '0',
227
  'sort_order' => 'ASC',
228
  'sort_column' => 'menu_order, post_title',
242
  'strip_tags' => 1
243
  ), $atts ) );
244
 
245
+ if( $child_of == '0' ){
246
  $child_of = $post->ID;
247
  }
248
 
249
+ $page_list_ext_args = array(
 
 
 
 
250
  'show_image' => $show_image,
251
  'show_title' => $show_title,
252
  'show_content' => $show_content,
253
  'limit_content' => $limit_content,
254
  'image_width' => $image_width,
255
  'image_height' => $image_height,
256
+ 'child_of' => pagelist_norm_params($child_of),
257
  'sort_order' => $sort_order,
258
  'sort_column' => $sort_column,
259
  'hierarchical' => $hierarchical,
260
+ 'exclude' => pagelist_norm_params($exclude),
261
  'include' => $include,
262
  'meta_key' => $meta_key,
263
  'meta_value' => $meta_value,
271
  'class' => $class,
272
  'strip_tags' => $strip_tags
273
  );
274
+ $list_pages = get_pages( $page_list_ext_args );
275
  $list_pages_html = '';
276
  foreach($list_pages as $page){
277
  $link = get_permalink( $page->ID );
287
  $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></h3>';
288
  }
289
  if( $show_content == 1 ){
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>';
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 = '';
310
 
311
  if ( !function_exists('page_list_parse_content') ) {
312
  function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1) {
 
 
313
  $output = '';
 
314
  if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
315
  $content = explode($matches[0], $content, 2);
316
 
335
  }
336
  $content = array($content);
337
  }
 
338
  $output .= $content[0];
 
339
  $output = force_balance_tags($output);
 
340
  return $output;
341
  }
342
  }
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.7
9
 
10
  "Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -59,8 +59,8 @@ Shortcode [pagelist_ext] accept the same parameters.
59
  * **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
60
  * **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
61
  * **limit_content** - content is limited by "more-tag" if it is exist or by "limit_content" parameter `[pagelist_ext limit_content="100"]`; by default: limit_content="250";
62
- * **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="40";
63
- * **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="40";
64
  * **child_of** - if you want to show subpages of the specific page you can use this shortcode: `[pagelist_ext child_of="4"]` where `4` is the ID of the specific page; by default it shows subpages to the current page;
65
  * **parent** - if you want to show subpages of the specific page only you can use this shortcode: `[pagelist_ext parent="4"]` where `4` is the ID of the specific page and the depth will be only one level; by default parent="-1" and depth is unlimited;
66
  * **sort_order** - if you want to change the sort order of the list of pages (either ascending or descending) you can use this shortcode: `[pagelist_ext sort_order="desc"]`; by default: sort_order="asc"; you can use this values for `sort_order` parameter: asc, desc;
@@ -78,8 +78,17 @@ Shortcode [pagelist_ext] accept the same parameters.
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
  == Changelog ==
82
 
 
 
 
 
83
  = 1.7 =
84
  * Added strip_tags parameter;
85
 
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
 
59
  * **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
60
  * **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
61
  * **limit_content** - content is limited by "more-tag" if it is exist or by "limit_content" parameter `[pagelist_ext limit_content="100"]`; by default: limit_content="250";
62
+ * **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="50";
63
+ * **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="50";
64
  * **child_of** - if you want to show subpages of the specific page you can use this shortcode: `[pagelist_ext child_of="4"]` where `4` is the ID of the specific page; by default it shows subpages to the current page;
65
  * **parent** - if you want to show subpages of the specific page only you can use this shortcode: `[pagelist_ext parent="4"]` where `4` is the ID of the specific page and the depth will be only one level; by default parent="-1" and depth is unlimited;
66
  * **sort_order** - if you want to change the sort order of the list of pages (either ascending or descending) you can use this shortcode: `[pagelist_ext sort_order="desc"]`; by default: sort_order="asc"; you can use this values for `sort_order` parameter: asc, desc;
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
+
83
+ 1. [pagelist] shortcode;
84
+ 2. [pagelist_ext] shortcode;
85
+
86
  == Changelog ==
87
 
88
+ = 1.8 =
89
+ * Added screenshots;
90
+ * Improved parameter parsing;
91
+
92
  = 1.7 =
93
  * Added strip_tags parameter;
94
 
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file