Page-list - Version 1.5

Version Description

  • Added [pagelist_ext] shortcode - list of pages with featured image;
Download this release

Release Info

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

Code changes from version 1.4 to 1.5

Files changed (2) hide show
  1. page-list.php +86 -7
  2. readme.txt +51 -25
page-list.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
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] and [siblings] shortcodes.
6
- Version: 1.4
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -72,7 +72,7 @@ if ( !function_exists('pagelist_shortcode') ) {
72
  $list_pages = wp_list_pages( $page_list_args );
73
 
74
  if ($list_pages) {
75
- $return = "\n".'<!-- powered by Page-list plugin ver. 1.4 (wordpress.org/extend/plugins/page-list/) -->'."\n";
76
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
77
  }else{
78
  $return = '';
@@ -80,7 +80,8 @@ if ( !function_exists('pagelist_shortcode') ) {
80
  return $return;
81
  }
82
  add_shortcode( 'pagelist', 'pagelist_shortcode' );
83
- add_shortcode( 'page-list', 'pagelist_shortcode' );
 
84
  add_shortcode( 'sitemap', 'pagelist_shortcode' );
85
  }
86
 
@@ -131,7 +132,7 @@ if ( !function_exists('subpages_shortcode') ) {
131
  $list_pages = wp_list_pages( $page_list_args );
132
 
133
  if ($list_pages) {
134
- $return = "\n".'<!-- powered by Page-list plugin ver. 1.4 (wordpress.org/extend/plugins/page-list/) -->'."\n";
135
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
136
  }else{
137
  $return = '';
@@ -139,7 +140,8 @@ if ( !function_exists('subpages_shortcode') ) {
139
  return $return;
140
  }
141
  add_shortcode( 'subpages', 'subpages_shortcode' );
142
- add_shortcode( 'sub-pages', 'subpages_shortcode' );
 
143
  add_shortcode( 'children', 'subpages_shortcode' );
144
  }
145
 
@@ -194,7 +196,7 @@ if ( !function_exists('siblings_shortcode') ) {
194
  $list_pages = wp_list_pages( $page_list_args );
195
 
196
  if ($list_pages) {
197
- $return = "\n".'<!-- powered by Page-list plugin ver. 1.4 (wordpress.org/extend/plugins/page-list/) -->'."\n";
198
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
199
  }else{
200
  $return = '';
@@ -203,3 +205,80 @@ if ( !function_exists('siblings_shortcode') ) {
203
  }
204
  add_shortcode( 'siblings', 'siblings_shortcode' );
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
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_image] shortcodes.
6
+ Version: 1.5
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
72
  $list_pages = wp_list_pages( $page_list_args );
73
 
74
  if ($list_pages) {
75
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.5 (wordpress.org/extend/plugins/page-list/) -->'."\n";
76
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
77
  }else{
78
  $return = '';
80
  return $return;
81
  }
82
  add_shortcode( 'pagelist', 'pagelist_shortcode' );
83
+ add_shortcode( 'page_list', 'pagelist_shortcode' );
84
+ add_shortcode( 'page-list', 'pagelist_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
85
  add_shortcode( 'sitemap', 'pagelist_shortcode' );
86
  }
87
 
132
  $list_pages = wp_list_pages( $page_list_args );
133
 
134
  if ($list_pages) {
135
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.5 (wordpress.org/extend/plugins/page-list/) -->'."\n";
136
  $return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
137
  }else{
138
  $return = '';
140
  return $return;
141
  }
142
  add_shortcode( 'subpages', 'subpages_shortcode' );
143
+ add_shortcode( 'sub_pages', 'subpages_shortcode' );
144
+ add_shortcode( 'sub-pages', 'subpages_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
145
  add_shortcode( 'children', 'subpages_shortcode' );
146
  }
147
 
196
  $list_pages = wp_list_pages( $page_list_args );
197
 
198
  if ($list_pages) {
199
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.5 (wordpress.org/extend/plugins/page-list/) -->'."\n";
200
  $return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
201
  }else{
202
  $return = '';
205
  }
206
  add_shortcode( 'siblings', 'siblings_shortcode' );
207
  }
208
+
209
+ if ( !function_exists('page_list_ext_shortcode') ) {
210
+ function page_list_ext_shortcode( $atts ) {
211
+ global $post;
212
+ $return = '';
213
+ extract( shortcode_atts( array(
214
+ 'image_width' => '40',
215
+ 'image_height' => '40',
216
+ 'child_of' => '0',
217
+ 'sort_order' => 'ASC',
218
+ 'sort_column' => 'menu_order, post_title',
219
+ 'hierarchical' => 1,
220
+ 'exclude' => '0',
221
+ 'include' => '0',
222
+ 'meta_key' => '',
223
+ 'meta_value' => '',
224
+ 'authors' => '',
225
+ 'parent' => -1,
226
+ 'exclude_tree' => '',
227
+ 'number' => '',
228
+ 'offset' => 0,
229
+ 'post_type' => 'page',
230
+ 'post_status' => 'publish',
231
+ 'class' => ''
232
+ ), $atts ) );
233
+
234
+ if( $child_of == 'current' || $child_of == 'this' || $child_of == '0' ){
235
+ $child_of = $post->ID;
236
+ }
237
+
238
+ if( $exclude == 'current' || $exclude == 'this' ){
239
+ $exclude = $post->ID;
240
+ }
241
+
242
+ $page_list_image_args = array(
243
+ 'image_width' => $image_width,
244
+ 'image_height' => $image_height,
245
+ 'child_of' => $child_of,
246
+ 'sort_order' => $sort_order,
247
+ 'sort_column' => $sort_column,
248
+ 'hierarchical' => $hierarchical,
249
+ 'exclude' => $exclude,
250
+ 'include' => $include,
251
+ 'meta_key' => $meta_key,
252
+ 'meta_value' => $meta_value,
253
+ 'authors' => $authors,
254
+ 'parent' => $parent,
255
+ 'exclude_tree' => $exclude_tree,
256
+ 'number' => $number,
257
+ 'offset' => $offset,
258
+ 'post_type' => $post_type,
259
+ 'post_status' => $post_status,
260
+ 'class' => $class
261
+ );
262
+ $list_pages = get_pages( $page_list_image_args );
263
+ $list_pages_html = '';
264
+ foreach($list_pages as $page){
265
+ $link = get_permalink( $page->ID );
266
+ $list_pages_html .= '<li>';
267
+ if( get_the_post_thumbnail($page->ID) ){
268
+ $list_pages_html .= '<span class="page-list-ext-item"><a href="'.$link.'" title="'.$page->post_title.'">';
269
+ $list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height));
270
+ $list_pages_html .= '</a></span> ';
271
+ }
272
+ $list_pages_html .= '<span class="page-list-ext-link-item"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></span>';
273
+ $list_pages_html .= '</li>'."\n";
274
+ }
275
+ if ($list_pages_html) {
276
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.5 (wordpress.org/extend/plugins/page-list/) -->'."\n";
277
+ $return .= '<ul class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</ul>';
278
+ }else{
279
+ $return = '';
280
+ }
281
+ return $return;
282
+ }
283
+ add_shortcode( 'pagelist_ext', 'page_list_ext_shortcode' );
284
+ }
readme.txt CHANGED
@@ -1,23 +1,25 @@
1
  === Page-list ===
2
  Contributors: webvitaly
3
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
4
- Tags: page, page-list, pagelist, sitemap, subpages
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.4
9
 
10
- "Page-list" plugin helps you to show list of pages with [pagelist], [subpages] and [siblings] shortcodes.
11
 
12
  == Description ==
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) function;
 
17
  = Examples: =
18
  * show hierarchical tree of pages: `[pagelist]`;
19
  * show hierarchical tree of subpages: `[subpages]`;
20
  * show hierarchical tree of sibling pages: `[siblings]`;
 
21
 
22
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
23
 
@@ -27,32 +29,56 @@ Plugin is based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Templ
27
 
28
  = Documentation =
29
 
30
- Plugin is based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) function;
31
  You can use aditional parameters: **`[pagelist depth="2" child_of="4" exclude="6,7,8"]`**.
32
  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.
33
 
34
- = Parameters: =
35
- * 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"]`;
36
- * if you want to show flat list of pages (not hierarchical tree) you can use this shortcode: `[pagelist depth="-1"]`;
37
- * if you want to show subpages of the specific page you can use this shortcode: `[pagelist child_of="4"]` where `4` is the ID of the specific page;
38
- * if you want to show subpages of the current page you can use this shortcodes: `[subpages]` or `[pagelist child_of="current"]` or `[pagelist child_of="this"]`;
39
- * if you want to show sibling pages of the current page you can use this shortcodes: `[siblings]` or `[pagelist child_of="parent"]`;
40
- * if you want to exclude some pages from the list you can use this shortcode: `[pagelist exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs; You may exclude current page with this shortcode: `[pagelist exclude="current"]`;
41
- * if you want to exclude the tree of pages from the list you can use this shortcode: `[pagelist exclude_tree="7,10"]` where `exclude_tree` parameter accepts comma-separated list of Page IDs (all this pages and their subpages will be excluded);
42
- * if you want to include certain pages into the list of pages you can use this shortcode: `[pagelist include="6,7,8"]` where `include` parameter accepts comma-separated list of Page IDs;
43
- * if you want to specify the title of the list of pages you can use this shortcode: `[pagelist title_li="<h2>List of pages</h2>"]`; by default there is no title (title_li="");
44
- * if you want to specify the number of pages to be included into list of pages you can use this shortcode: `[pagelist number="10"]`; by default the number is unlimited (number="");
45
- * if you want to pass over (or displace) some pages you can use this shortcode: `[pagelist offset="5"]`; by default there is no offset (offset="");
46
- * if you want to include the pages that have this Custom Field Key you can use this shortcode: `[pagelist meta_key="metakey" meta_value="metaval"]`;
47
- * if you want to show the date of the page you can use this shortcode: `[pagelist show_date="created"]`; you can use this values for `show_date` parameter: created, modified, updated;
48
- * if you want to specify the column by what to sort you can use this shortcode: `[pagelist sort_column="menu_order"]`; by default order columns are `menu_order` and `post_title` (sort_column="menu_order, post_title"); you can use this values for `sort_column` parameter: post_title, menu_order, post_date (sort by creation time), post_modified (sort by last modified time), ID, post_author (sort by the page author's numeric ID), post_name (sort by page slug);
49
- * if you want to change the sort order of the list of pages (either ascending or descending) you can use this shortcode: `[pagelist sort_order="desc"]`; by default sort_order is `asc` (sort_order="asc"); you can use this values for `sort_order` parameter: asc, desc;
50
- * if you want to specify the text or html that precedes the link text inside the link tag you can use this shortcode: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
51
- * if you want to specify the text or html that follows the link text inside the link tag you can use this shortcode: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
52
- * if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist class="listclass"]`; by default the class is empty (class="");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  == Changelog ==
55
 
 
 
 
56
  = 1.4 =
57
  * Added exclude="current" parameter;
58
 
@@ -69,4 +95,4 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
69
  == Installation ==
70
 
71
  1. Install plugin and activate it on the Plugins page;
72
- 2. Add shortcode `[pagelist]`, `[subpages]` or `[siblings]` to page content;
1
  === Page-list ===
2
  Contributors: webvitaly
3
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
4
+ 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.5
9
 
10
+ "Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
12
  == Description ==
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]`;
21
  * show hierarchical tree of sibling pages: `[siblings]`;
22
+ * show list of pages with featured images: `[pagelist_ext]`;
23
 
24
  [Page-list plugin page](http://web-profile.com.ua/wordpress/plugins/page-list/)
25
 
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;
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;
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"]`;
42
+ * **child_of** - if you want to show subpages of the specific page you can use this shortcode: `[pagelist child_of="4"]` where `4` is the ID of the specific page; If you want to show subpages of the current page you can use this shortcodes: `[subpages]` or `[pagelist child_of="current"]` or `[pagelist child_of="this"]`; If you want to show sibling pages of the current page you can use this shortcodes: `[siblings]` or `[pagelist child_of="parent"]`;
43
+ * **exclude** - if you want to exclude some pages from the list you can use this shortcode: `[pagelist exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs; You may exclude current page with this shortcode: `[pagelist exclude="current"]`;
44
+ * **exclude_tree** - if you want to exclude the tree of pages from the list you can use this shortcode: `[pagelist exclude_tree="7,10"]` where `exclude_tree` parameter accepts comma-separated list of Page IDs (all this pages and their subpages will be excluded);
45
+ * **include** - if you want to include certain pages into the list of pages you can use this shortcode: `[pagelist include="6,7,8"]` where `include` parameter accepts comma-separated list of Page IDs;
46
+ * **title_li** - if you want to specify the title of the list of pages you can use this shortcode: `[pagelist title_li="<h2>List of pages</h2>"]`; by default there is no title (title_li="");
47
+ * **number** - if you want to specify the number of pages to be included into list of pages you can use this shortcode: `[pagelist number="10"]`; by default the number is unlimited (number="");
48
+ * **offset** - if you want to pass over (or displace) some pages you can use this shortcode: `[pagelist offset="5"]`; by default there is no offset (offset="");
49
+ * **meta_key** - if you want to include the pages that have this Custom Field Key you can use this shortcode: `[pagelist meta_key="metakey" meta_value="metaval"]`;
50
+ * **show_date** - if you want to show the date of the page you can use this shortcode: `[pagelist show_date="created"]`; you can use this values for `show_date` parameter: created, modified, updated;
51
+ * **menu_order** - if you want to specify the column by what to sort you can use this shortcode: `[pagelist sort_column="menu_order"]`; by default order columns are `menu_order` and `post_title` (sort_column="menu_order, post_title"); you can use this values for `sort_column` parameter: post_title, menu_order, post_date (sort by creation time), post_modified (sort by last modified time), ID, post_author (sort by the page author's numeric ID), post_name (sort by page slug);
52
+ * **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 sort_order="desc"]`; by default sort_order is `asc` (sort_order="asc"); you can use this values for `sort_order` parameter: asc, desc;
53
+ * **link_before** - if you want to specify the text or html that precedes the link text inside the link tag you can use this shortcode: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
54
+ * **link_after** - if you want to specify the text or html that follows the link text inside the link tag you can use this shortcode: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
55
+ * **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist class="listclass"]`; by default the class is empty (class="");
56
+
57
+ = Parameters for [pagelist_ext]: =
58
+ * **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="40";
59
+ * **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="40";
60
+ * **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;
61
+ * **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;
62
+ * **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;
63
+ * **sort_column** - if you want to specify the column by what to sort you can use this shortcode: `[pagelist_ext sort_column="menu_order"]`; by default order columns are `sort_column` and `post_title` (sort_column="menu_order, post_title"); you can use this values for `sort_column` parameter: post_title, menu_order, post_date (sort by creation time), post_modified (sort by last modified time), ID, post_author (sort by the page author's numeric ID), post_name (sort by page slug);
64
+ * **hierarchical** - display sub-pages below their parent page `[pagelist_ext hierarchical="0"]`; by default: hierarchical="1";
65
+ * **exclude** - if you want to exclude some pages from the list you can use this shortcode: `[pagelist_ext exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs;
66
+ * **exclude_tree** - if you want to exclude the tree of pages from the list you can use this shortcode: `[pagelist_ext exclude_tree="7,10"]` where `exclude_tree` parameter accepts comma-separated list of Page IDs (all this pages and their subpages will be excluded);
67
+ * **include** - if you want to include certain pages into the list of pages you can use this shortcode: `[pagelist_ext include="6,7,8"]` where `include` parameter accepts comma-separated list of Page IDs;
68
+ * **meta_key** - if you want to include the pages that have this Custom Field Key you can use this shortcode: `[pagelist_ext meta_key="metakey" meta_value="metaval"]`;
69
+ * **authors** - only include the pages written by the given author(s) `[pagelist_ext authors="6,7,8"]`;
70
+ * **number** - if you want to specify the number of pages to be included into list of pages you can use this shortcode: `[pagelist_ext number="10"]`; by default the number is unlimited (number="");
71
+ * **offset** - if you want to pass over (or displace) some pages you can use this shortcode: `[pagelist_ext offset="5"]`; by default there is no offset (offset="");
72
+ * **post_type** - `[pagelist_ext post_type="page"]`;
73
+ * **post_status** - `[pagelist_ext post_status="publish"]`;
74
+ * **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="");
75
+
76
 
77
  == Changelog ==
78
 
79
+ = 1.5 =
80
+ * Added [pagelist_ext] shortcode - list of pages with featured image;
81
+
82
  = 1.4 =
83
  * Added exclude="current" parameter;
84
 
95
  == Installation ==
96
 
97
  1. Install plugin and activate it on the Plugins page;
98
+ 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;