Sitemap - Version 2.2

Version Description

  • Fixed offset parameter;
Download this release

Release Info

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

Code changes from version 2.1 to 2.2

Files changed (2) hide show
  1. readme.txt +5 -2
  2. sitemap.php +56 -49
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: 2.1
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -86,6 +86,9 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 2.1 =
90
  * Fixed number parameter;
91
 
@@ -125,4 +128,4 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
125
  == Installation ==
126
 
127
  1. Install plugin and activate it on the Plugins page;
128
- 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: 2.2
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
86
 
87
  == Changelog ==
88
 
89
+ = 2.2 =
90
+ * Fixed offset parameter;
91
+
92
  = 2.1 =
93
  * Fixed number parameter;
94
 
128
  == Installation ==
129
 
130
  1. Install plugin and activate it on the Plugins page;
131
+ 2. Add shortcode `[pagelist]`, `[subpages]`, `[siblings]` or `[pagelist_ext]` to page content;
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: 2.1
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, '2.1', '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.2.1 (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.2.1 (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.2.1 (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 = '';
@@ -269,7 +269,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
269
  'parent' => $parent,
270
  'exclude_tree' => $exclude_tree,
271
  'number' => '', // $number - own counter
272
- 'offset' => $offset,
273
  'post_type' => $post_type,
274
  'post_status' => $post_status,
275
  'class' => $class,
@@ -282,60 +282,67 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
282
  $list_pages = get_pages( $page_list_ext_args );
283
  $list_pages_html = '';
284
  $count = 0;
 
285
  foreach($list_pages as $page){
286
  $count++;
287
- if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
288
- $link = get_permalink( $page->ID );
289
- $list_pages_html .= '<div class="page-list-ext-item">';
290
- if( $show_image == 1 ){
291
- if (function_exists('get_the_post_thumbnail')) {
292
- if( get_the_post_thumbnail($page->ID) ){
293
- $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.$page->post_title.'">';
294
- $list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height));
295
- $list_pages_html .= '</a></div> ';
 
 
 
 
 
 
296
  }
297
  }
298
- }
299
- if( $show_title == 1 ){
300
- $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></h3>';
301
- }
302
- if( $show_content == 1 ){
303
- //$content = apply_filters('the_content', $page->post_content);
304
- //$content = str_replace(']]>', ']]&gt;', $content);
305
- $content = page_list_parse_content( $page->post_content, $limit_content, $strip_tags );
306
- $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
307
- }
308
- if( $show_child_count == 1 ){
309
- $count_subpages = count(get_pages("child_of=".$page->ID));
310
- if( $count_subpages > 0 ){ // hide empty
311
- $child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
312
- if($child_count_pos === false) { // %child_count% not found in template
313
- $child_count_template_html = $child_count_template.' '.$count_subpages;
314
- $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
315
- } else { // %child_count% found in template
316
- $child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
317
- $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
318
  }
319
  }
320
- }
321
- if( $show_meta_key != '' ){
322
- $post_meta = get_post_meta($page->ID, $show_meta_key, true);
323
- if( !empty($post_meta) ){ // hide empty
324
- $meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
325
- if($meta_pos === false) { // %meta% not found in template
326
- $meta_template_html = $meta_template.' '.$post_meta;
327
- $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
328
- } else { // %meta% found in template
329
- $meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
330
- $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
331
  }
332
  }
 
333
  }
334
- $list_pages_html .= '</div>'."\n";
335
  }
336
  }
337
  if ($list_pages_html) {
338
- $return = "\n".'<!-- powered by Page-list plugin ver.2.1 (wordpress.org/extend/plugins/page-list/) -->'."\n";
339
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
340
  }else{
341
  $return = '';
@@ -377,4 +384,4 @@ if ( !function_exists('page_list_parse_content') ) {
377
  $output = force_balance_tags($output);
378
  return $output;
379
  }
380
- }
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: 2.2
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, '2.2', '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.2.2 (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.2.2 (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.2.2 (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 = '';
269
  'parent' => $parent,
270
  'exclude_tree' => $exclude_tree,
271
  'number' => '', // $number - own counter
272
+ 'offset' => 0, // $offset - own offset
273
  'post_type' => $post_type,
274
  'post_status' => $post_status,
275
  'class' => $class,
282
  $list_pages = get_pages( $page_list_ext_args );
283
  $list_pages_html = '';
284
  $count = 0;
285
+ $offset_count = 0;
286
  foreach($list_pages as $page){
287
  $count++;
288
+ $offset_count++;
289
+ if ( !empty( $offset ) && is_numeric( $offset ) && $offset_count <= $offset ) {
290
+ $count = 0; // number counter to zero if offset is not finished
291
+ }
292
+ if ( ( !empty( $offset ) && is_numeric( $offset ) && $offset_count > $offset ) || ( empty( $offset ) ) || ( !empty( $offset ) && !is_numeric( $offset ) ) ) {
293
+ if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
294
+ $link = get_permalink( $page->ID );
295
+ $list_pages_html .= '<div class="page-list-ext-item">';
296
+ if( $show_image == 1 ){
297
+ if (function_exists('get_the_post_thumbnail')) {
298
+ if( get_the_post_thumbnail($page->ID) ){
299
+ $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.$page->post_title.'">';
300
+ $list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height));
301
+ $list_pages_html .= '</a></div> ';
302
+ }
303
  }
304
  }
305
+ if( $show_title == 1 ){
306
+ $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></h3>';
307
+ }
308
+ if( $show_content == 1 ){
309
+ //$content = apply_filters('the_content', $page->post_content);
310
+ //$content = str_replace(']]>', ']]&gt;', $content);
311
+ $content = page_list_parse_content( $page->post_content, $limit_content, $strip_tags );
312
+ $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
313
+ }
314
+ if( $show_child_count == 1 ){
315
+ $count_subpages = count(get_pages("child_of=".$page->ID));
316
+ if( $count_subpages > 0 ){ // hide empty
317
+ $child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
318
+ if($child_count_pos === false) { // %child_count% not found in template
319
+ $child_count_template_html = $child_count_template.' '.$count_subpages;
320
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
321
+ } else { // %child_count% found in template
322
+ $child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
323
+ $list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
324
+ }
325
  }
326
  }
327
+ if( $show_meta_key != '' ){
328
+ $post_meta = get_post_meta($page->ID, $show_meta_key, true);
329
+ if( !empty($post_meta) ){ // hide empty
330
+ $meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
331
+ if($meta_pos === false) { // %meta% not found in template
332
+ $meta_template_html = $meta_template.' '.$post_meta;
333
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
334
+ } else { // %meta% found in template
335
+ $meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
336
+ $list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
337
+ }
338
  }
339
  }
340
+ $list_pages_html .= '</div>'."\n";
341
  }
 
342
  }
343
  }
344
  if ($list_pages_html) {
345
+ $return = "\n".'<!-- powered by Page-list plugin ver.2.2 (wordpress.org/extend/plugins/page-list/) -->'."\n";
346
  $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
347
  }else{
348
  $return = '';
384
  $output = force_balance_tags($output);
385
  return $output;
386
  }
387
+ }