Sitemap - Version 1.6

Version Description

  • Improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
Download this release

Release Info

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

Code changes from version 1.5 to 1.6

Files changed (3) hide show
  1. css/page-list.css +5 -0
  2. readme.txt +8 -1
  3. sitemap.php +77 -16
css/page-list.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /* Page-list plugin styles (wordpress.org/extend/plugins/page-list/) */
2
+
3
+ .page-list-ext .page-list-ext-item {clear:both; margin:10px 0 20px 0;}
4
+ .page-list-ext .page-list-ext-image {float:left; display:inline; margin:5px 10px 10px 0;}
5
+ .page-list-ext .page-list-ext-title {clear:none;}
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.5
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
@@ -57,6 +57,10 @@ Shortcode [pagelist_ext] accept the same parameters.
57
  * **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="");
58
 
59
  = Parameters for [pagelist_ext]: =
 
 
 
 
60
  * **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="40";
61
  * **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="40";
62
  * **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;
@@ -78,6 +82,9 @@ Shortcode [pagelist_ext] accept the same parameters.
78
 
79
  == Changelog ==
80
 
 
 
 
81
  = 1.5 =
82
  * Added [pagelist_ext] shortcode - list of pages with featured image;
83
 
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.6
9
 
10
  "Sitemap" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
11
 
57
  * **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="");
58
 
59
  = Parameters for [pagelist_ext]: =
60
+ * **show_image** - show or hide featured image `[pagelist_ext show_image="0"]`; by default: show_image="1";
61
+ * **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
62
+ * **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
63
+ * **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";
64
  * **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="40";
65
  * **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="40";
66
  * **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;
82
 
83
  == Changelog ==
84
 
85
+ = 1.6 =
86
+ * Improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
87
+
88
  = 1.5 =
89
  * Added [pagelist_ext] shortcode - list of pages with featured image;
90
 
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.5
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -15,6 +15,11 @@ Future features:
15
  - exclude_post_page;
16
  */
17
 
 
 
 
 
 
18
  if ( !function_exists('pagelist_shortcode') ) {
19
  function pagelist_shortcode( $atts ) {
20
  global $post;
@@ -72,7 +77,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.5 (wordpress.org/extend/plugins/page-list/) -->'."\n";
76
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
77
  }else{
78
  $return = '';
@@ -132,7 +137,7 @@ if ( !function_exists('subpages_shortcode') ) {
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 = '';
@@ -196,7 +201,7 @@ if ( !function_exists('siblings_shortcode') ) {
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 = '';
@@ -206,11 +211,15 @@ if ( !function_exists('siblings_shortcode') ) {
206
  add_shortcode( 'siblings', 'siblings_shortcode' );
207
  }
208
 
209
- if ( !function_exists('page_list_image_shortcode') ) {
210
- function page_list_image_shortcode( $atts ) {
211
  global $post;
212
  $return = '';
213
  extract( shortcode_atts( array(
 
 
 
 
214
  'image_width' => '40',
215
  'image_height' => '40',
216
  'child_of' => '0',
@@ -240,6 +249,10 @@ if ( !function_exists('page_list_image_shortcode') ) {
240
  }
241
 
242
  $page_list_image_args = array(
 
 
 
 
243
  'image_width' => $image_width,
244
  'image_height' => $image_height,
245
  'child_of' => $child_of,
@@ -263,22 +276,70 @@ if ( !function_exists('page_list_image_shortcode') ) {
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_image_shortcode' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
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.6
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
15
  - exclude_post_page;
16
  */
17
 
18
+ add_action('wp_print_styles', 'page_list_add_stylesheet');
19
+ function page_list_add_stylesheet() {
20
+ wp_enqueue_style( 'my-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '1.6', 'all' );
21
+ }
22
+
23
  if ( !function_exists('pagelist_shortcode') ) {
24
  function pagelist_shortcode( $atts ) {
25
  global $post;
77
  $list_pages = wp_list_pages( $page_list_args );
78
 
79
  if ($list_pages) {
80
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
81
  $return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
82
  }else{
83
  $return = '';
137
  $list_pages = wp_list_pages( $page_list_args );
138
 
139
  if ($list_pages) {
140
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.6 (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 = '';
201
  $list_pages = wp_list_pages( $page_list_args );
202
 
203
  if ($list_pages) {
204
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.6 (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 = '';
211
  add_shortcode( 'siblings', 'siblings_shortcode' );
212
  }
213
 
214
+ if ( !function_exists('pagelist_ext_shortcode') ) {
215
+ function pagelist_ext_shortcode( $atts ) {
216
  global $post;
217
  $return = '';
218
  extract( shortcode_atts( array(
219
+ 'show_image' => 1,
220
+ 'show_title' => 1,
221
+ 'show_content' => 1,
222
+ 'limit_content' => 250,
223
  'image_width' => '40',
224
  'image_height' => '40',
225
  'child_of' => '0',
249
  }
250
 
251
  $page_list_image_args = array(
252
+ 'show_image' => $show_image,
253
+ 'show_title' => $show_title,
254
+ 'show_content' => $show_content,
255
+ 'limit_content' => $limit_content,
256
  'image_width' => $image_width,
257
  'image_height' => $image_height,
258
  'child_of' => $child_of,
276
  $list_pages_html = '';
277
  foreach($list_pages as $page){
278
  $link = get_permalink( $page->ID );
279
+ $list_pages_html .= '<div class="page-list-ext-item">';
280
+ if( $show_image == 1 ){
281
+ if( get_the_post_thumbnail($page->ID) ){
282
+ $list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.$page->post_title.'">';
283
+ $list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height));
284
+ $list_pages_html .= '</a></div> ';
285
+ }
286
+ }
287
+ if( $show_title == 1 ){
288
+ $list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.$page->post_title.'">'.$page->post_title.'</a></h3>';
289
+ }
290
+ if( $show_content == 1 ){
291
+ $content = apply_filters('the_content', $page->post_content);
292
+ $content = str_replace(']]>', ']]&gt;', $content);
293
+ $content = page_list_parse_content( $page->post_content, $limit_content );
294
+
295
+ $list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
296
  }
297
+
298
+ $list_pages_html .= '</div>'."\n";
299
  }
300
  if ($list_pages_html) {
301
+ $return = "\n".'<!-- powered by Page-list plugin ver.1.6 (wordpress.org/extend/plugins/page-list/) -->'."\n";
302
+ $return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
303
  }else{
304
  $return = '';
305
  }
306
  return $return;
307
  }
308
+ add_shortcode( 'pagelist_ext', 'pagelist_ext_shortcode' );
309
+ }
310
+
311
+
312
+ if ( !function_exists('page_list_parse_content') ) {
313
+ function page_list_parse_content($content, $limit_content = 250) {
314
+ global $more, $preview;
315
+
316
+ $output = '';
317
+
318
+ if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
319
+ $content = explode($matches[0], $content, 2);
320
+
321
+ } else {
322
+ //$content_stripped = strip_tags($content); // ,'<p>'
323
+ $content_stripped = $content;
324
+ if( strlen($content_stripped) > $limit_content ){
325
+ $pos = strpos($content_stripped, ' ', $limit_content);
326
+ if ($pos !== false) {
327
+ $first_space_pos = $pos;
328
+ }else{
329
+ $first_space_pos = $limit_content;
330
+ }
331
+ $content_cut = mb_substr($content_stripped, 0, $first_space_pos,'UTF-8');
332
+ $content = $content_cut.'...';
333
+ }else{
334
+ $content = $content_stripped;
335
+ }
336
+ $content = array($content);
337
+ }
338
+
339
+ $output .= $content[0];
340
+
341
+ $output = force_balance_tags($output);
342
+
343
+ return $output;
344
+ }
345
  }