Version Description
- 2015.01.25 =
- code refactor
- update docs
- added 'authors', 'post_type', 'post_status', 'date_format' params to [pagelist], [subpages], [siblings] shortcodes (thanks to Nick Ciske)
Download this release
Release Info
Developer | webvitaly |
Plugin | Page-list |
Version | 5.0 |
Comparing to | |
See all releases |
Code changes from version 4.3 to 5.0
- page-list.php +107 -142
- readme.txt +56 -44
page-list.php
CHANGED
@@ -3,45 +3,55 @@
|
|
3 |
Plugin Name: Page-list
|
4 |
Plugin URI: http://wordpress.org/plugins/page-list/
|
5 |
Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
6 |
-
Version:
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
if ( !function_exists('pagelist_unqprfx_add_stylesheet') ) {
|
13 |
function pagelist_unqprfx_add_stylesheet() {
|
14 |
-
wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false,
|
15 |
}
|
16 |
add_action('wp_enqueue_scripts', 'pagelist_unqprfx_add_stylesheet');
|
17 |
}
|
18 |
|
19 |
|
20 |
-
$pagelist_unqprfx_powered_line = "\n".'<!-- Page-list plugin v.4.3 wordpress.org/plugins/page-list/ -->'."\n";
|
21 |
-
|
22 |
-
|
23 |
if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
24 |
function pagelist_unqprfx_shortcode( $atts ) {
|
25 |
-
global $post, $
|
26 |
$return = '';
|
27 |
-
extract( shortcode_atts(
|
28 |
-
'depth' => '0',
|
29 |
-
'child_of' => '0',
|
30 |
-
'exclude' => '0',
|
31 |
-
'exclude_tree' => '',
|
32 |
-
'include' => '0',
|
33 |
-
'title_li' => '',
|
34 |
-
'number' => '',
|
35 |
-
'offset' => '',
|
36 |
-
'meta_key' => '',
|
37 |
-
'meta_value' => '',
|
38 |
-
'show_date' => '',
|
39 |
-
'sort_column' => 'menu_order, post_title',
|
40 |
-
'sort_order' => 'ASC',
|
41 |
-
'link_before' => '',
|
42 |
-
'link_after' => '',
|
43 |
-
'class' => ''
|
44 |
-
), $atts ) );
|
45 |
|
46 |
$page_list_args = array(
|
47 |
'depth' => $depth,
|
@@ -55,21 +65,22 @@ if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
|
55 |
'meta_key' => $meta_key,
|
56 |
'meta_value' => $meta_value,
|
57 |
'show_date' => $show_date,
|
58 |
-
'date_format' =>
|
59 |
'echo' => 0,
|
60 |
-
'authors' =>
|
61 |
'sort_column' => $sort_column,
|
62 |
'sort_order' => $sort_order,
|
63 |
'link_before' => $link_before,
|
64 |
'link_after' => $link_after,
|
65 |
-
'
|
|
|
66 |
);
|
67 |
$list_pages = wp_list_pages( $page_list_args );
|
68 |
|
69 |
-
$return
|
70 |
if ($list_pages) {
|
71 |
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
72 |
-
}else{
|
73 |
$return .= '<!-- no pages to show -->';
|
74 |
}
|
75 |
return $return;
|
@@ -83,26 +94,9 @@ if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
|
83 |
|
84 |
if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
85 |
function subpages_unqprfx_shortcode( $atts ) {
|
86 |
-
global $post, $
|
87 |
$return = '';
|
88 |
-
extract( shortcode_atts(
|
89 |
-
'depth' => '0',
|
90 |
-
//'child_of' => '0',
|
91 |
-
'exclude' => '0',
|
92 |
-
'exclude_tree' => '',
|
93 |
-
'include' => '0',
|
94 |
-
'title_li' => '',
|
95 |
-
'number' => '',
|
96 |
-
'offset' => '',
|
97 |
-
'meta_key' => '',
|
98 |
-
'meta_value' => '',
|
99 |
-
'show_date' => '',
|
100 |
-
'sort_column' => 'menu_order, post_title',
|
101 |
-
'sort_order' => 'ASC',
|
102 |
-
'link_before' => '',
|
103 |
-
'link_after' => '',
|
104 |
-
'class' => ''
|
105 |
-
), $atts ) );
|
106 |
|
107 |
$page_list_args = array(
|
108 |
'depth' => $depth,
|
@@ -116,21 +110,22 @@ if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
|
116 |
'meta_key' => $meta_key,
|
117 |
'meta_value' => $meta_value,
|
118 |
'show_date' => $show_date,
|
119 |
-
'date_format' =>
|
120 |
'echo' => 0,
|
121 |
-
'authors' =>
|
122 |
'sort_column' => $sort_column,
|
123 |
'sort_order' => $sort_order,
|
124 |
'link_before' => $link_before,
|
125 |
'link_after' => $link_after,
|
126 |
-
'
|
|
|
127 |
);
|
128 |
$list_pages = wp_list_pages( $page_list_args );
|
129 |
|
130 |
-
$return
|
131 |
if ($list_pages) {
|
132 |
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
133 |
-
}else{
|
134 |
$return .= '<!-- no pages to show -->';
|
135 |
}
|
136 |
return $return;
|
@@ -142,28 +137,11 @@ if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
|
142 |
|
143 |
if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
144 |
function siblings_unqprfx_shortcode( $atts ) {
|
145 |
-
global $post, $
|
146 |
$return = '';
|
147 |
-
extract( shortcode_atts(
|
148 |
-
'depth' => '0',
|
149 |
-
//'child_of' => '0',
|
150 |
-
'exclude' => '0',
|
151 |
-
'exclude_tree' => '',
|
152 |
-
'include' => '0',
|
153 |
-
'title_li' => '',
|
154 |
-
'number' => '',
|
155 |
-
'offset' => '',
|
156 |
-
'meta_key' => '',
|
157 |
-
'meta_value' => '',
|
158 |
-
'show_date' => '',
|
159 |
-
'sort_column' => 'menu_order, post_title',
|
160 |
-
'sort_order' => 'ASC',
|
161 |
-
'link_before' => '',
|
162 |
-
'link_after' => '',
|
163 |
-
'class' => ''
|
164 |
-
), $atts ) );
|
165 |
|
166 |
-
if( $exclude == 'current' || $exclude == 'this' ){
|
167 |
$exclude = $post->ID;
|
168 |
}
|
169 |
|
@@ -179,21 +157,22 @@ if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
|
179 |
'meta_key' => $meta_key,
|
180 |
'meta_value' => $meta_value,
|
181 |
'show_date' => $show_date,
|
182 |
-
'date_format' =>
|
183 |
'echo' => 0,
|
184 |
-
'authors' =>
|
185 |
'sort_column' => $sort_column,
|
186 |
'sort_order' => $sort_order,
|
187 |
'link_before' => $link_before,
|
188 |
'link_after' => $link_after,
|
189 |
-
'
|
|
|
190 |
);
|
191 |
$list_pages = wp_list_pages( $page_list_args );
|
192 |
|
193 |
-
$return
|
194 |
if ($list_pages) {
|
195 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
196 |
-
}else{
|
197 |
$return .= '<!-- no pages to show -->';
|
198 |
}
|
199 |
return $return;
|
@@ -204,7 +183,7 @@ if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
|
204 |
|
205 |
if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
206 |
function pagelist_unqprfx_ext_shortcode( $atts ) {
|
207 |
-
global $post, $
|
208 |
$return = '';
|
209 |
extract( shortcode_atts( array(
|
210 |
'show_image' => 1,
|
@@ -239,7 +218,7 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
239 |
'meta_template' => '%meta%'
|
240 |
), $atts ) );
|
241 |
|
242 |
-
if( $child_of == '' ){ // show subpages if child_of is empty
|
243 |
$child_of = $post->ID;
|
244 |
}
|
245 |
|
@@ -252,15 +231,15 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
252 |
'limit_content' => $limit_content,
|
253 |
'image_width' => $image_width,
|
254 |
'image_height' => $image_height,
|
255 |
-
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
256 |
'sort_order' => $sort_order,
|
257 |
'sort_column' => $sort_column,
|
258 |
'hierarchical' => $hierarchical,
|
259 |
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
260 |
'include' => $include,
|
261 |
-
'meta_key'
|
262 |
-
'meta_value'
|
263 |
'authors' => $authors,
|
|
|
264 |
'parent' => pagelist_unqprfx_norm_params($parent),
|
265 |
'exclude_tree' => $exclude_tree,
|
266 |
'number' => '', // $number - own counter
|
@@ -284,15 +263,15 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
284 |
'limit_content' => $limit_content,
|
285 |
'image_width' => $image_width,
|
286 |
'image_height' => $image_height,
|
287 |
-
'child_of' => 0, // for showing all pages
|
288 |
'sort_order' => $sort_order,
|
289 |
'sort_column' => $sort_column,
|
290 |
'hierarchical' => $hierarchical,
|
291 |
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
292 |
'include' => $include,
|
293 |
-
'meta_key'
|
294 |
-
'meta_value'
|
295 |
'authors' => $authors,
|
|
|
296 |
'parent' => pagelist_unqprfx_norm_params($parent),
|
297 |
'exclude_tree' => $exclude_tree,
|
298 |
'number' => '', // $number - own counter
|
@@ -308,13 +287,13 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
308 |
'meta_template' => $meta_template
|
309 |
);
|
310 |
$list_pages = get_pages( $page_list_ext_args );
|
311 |
-
if( count( $list_pages ) == 0 ){ // if there is no subpages
|
312 |
$list_pages = get_pages( $page_list_ext_args_all ); // we are showing all pages
|
313 |
}
|
314 |
$list_pages_html = '';
|
315 |
$count = 0;
|
316 |
$offset_count = 0;
|
317 |
-
if( $list_pages !== false && count( $list_pages ) > 0 ){
|
318 |
foreach($list_pages as $page){
|
319 |
$count++;
|
320 |
$offset_count++;
|
@@ -325,33 +304,22 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
325 |
if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
|
326 |
$link = get_permalink( $page->ID );
|
327 |
$list_pages_html .= '<div class="page-list-ext-item">';
|
328 |
-
if( $show_image == 1 ){
|
329 |
-
if (
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
if( $show_first_image == 1 ){
|
341 |
-
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
342 |
-
if( !empty( $img_scr ) ){
|
343 |
-
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
344 |
-
$list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
345 |
-
$list_pages_html .= '</a></div> ';
|
346 |
-
}
|
347 |
-
}
|
348 |
-
}
|
349 |
-
}else{ // if we have old WordPress 2.8 or lower
|
350 |
-
if( $show_first_image == 1 ){
|
351 |
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
352 |
-
if( !empty( $img_scr ) ){
|
353 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
354 |
-
$list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
355 |
$list_pages_html .= '</a></div> ';
|
356 |
}
|
357 |
}
|
@@ -359,26 +327,26 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
359 |
}
|
360 |
|
361 |
|
362 |
-
if( $show_title == 1 ){
|
363 |
$list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
|
364 |
}
|
365 |
-
if( $show_content == 1 ){
|
366 |
//$content = apply_filters('the_content', $page->post_content);
|
367 |
//$content = str_replace(']]>', ']]>', $content); // both used in default the_content() function
|
368 |
|
369 |
-
if( !empty( $page->post_excerpt ) ){
|
370 |
$text_content = $page->post_excerpt;
|
371 |
-
}else{
|
372 |
$text_content = $page->post_content;
|
373 |
}
|
374 |
|
375 |
if ( post_password_required($page) ) {
|
376 |
$content = '<!-- password protected -->';
|
377 |
-
}else{
|
378 |
$content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
|
379 |
$content = do_shortcode( $content );
|
380 |
|
381 |
-
if( $show_title == 0 ){ // make content as a link if there is no title
|
382 |
$content = '<a href="'.$link.'">'.$content.'</a>';
|
383 |
}
|
384 |
}
|
@@ -386,28 +354,28 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
386 |
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
|
387 |
|
388 |
}
|
389 |
-
if( $show_child_count == 1 ){
|
390 |
$count_subpages = count(get_pages("child_of=".$page->ID));
|
391 |
-
if( $count_subpages > 0 ){ // hide empty
|
392 |
$child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
|
393 |
-
if($child_count_pos === false) { // %child_count% not found in template
|
394 |
-
$child_count_template_html =
|
395 |
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
396 |
} else { // %child_count% found in template
|
397 |
-
$child_count_template_html =
|
398 |
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
399 |
}
|
400 |
}
|
401 |
}
|
402 |
-
if( $show_meta_key != '' ){
|
403 |
$post_meta = get_post_meta($page->ID, $show_meta_key, true);
|
404 |
-
if( !empty($post_meta) ){ // hide empty
|
405 |
$meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
|
406 |
-
if($meta_pos === false) { // %meta% not found in template
|
407 |
-
$meta_template_html =
|
408 |
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
409 |
} else { // %meta% found in template
|
410 |
-
$meta_template_html =
|
411 |
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
412 |
}
|
413 |
}
|
@@ -417,10 +385,10 @@ if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
|
417 |
}
|
418 |
}
|
419 |
}
|
420 |
-
$return
|
421 |
if ($list_pages_html) {
|
422 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
423 |
-
}else{
|
424 |
$return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
|
425 |
}
|
426 |
return $return;
|
@@ -447,9 +415,8 @@ if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
|
447 |
function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
|
448 |
|
449 |
$more_tag_found = 0;
|
450 |
-
$content_before_more_tag_length = 0;
|
451 |
|
452 |
-
if( $more_tag ){ // "more_tag" have higher priority than "limit_content"
|
453 |
if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
|
454 |
$more_tag_found = 1;
|
455 |
$more_tag = $matches[0];
|
@@ -465,7 +432,7 @@ if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
|
465 |
//$content = preg_replace("@<!--@", "#!--#", $content); // save html comments
|
466 |
// strip tags normally
|
467 |
//$content = strip_tags($content);
|
468 |
-
if( $strip_tags ){
|
469 |
$content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
|
470 |
$content = strip_tags($content); // ,'<p>'
|
471 |
}
|
@@ -473,23 +440,23 @@ if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
|
473 |
//$content = preg_replace("@#\?#@", "<?", $content);
|
474 |
//$content = preg_replace("@#!--#@", "<!--", $content);
|
475 |
|
476 |
-
if( $strip_shortcodes ){
|
477 |
$content = strip_shortcodes( $content );
|
478 |
}
|
479 |
|
480 |
-
if( $more_tag && $more_tag_found ){ // "more_tag" have higher priority than "limit_content"
|
481 |
$fake_more_pos = mb_strpos($content, '###more###', 0, 'UTF-8');
|
482 |
-
if( $fake_more_pos === false ) {
|
483 |
// substring not found in string and this is strange :)
|
484 |
} else {
|
485 |
$content = mb_substr($content, 0, $fake_more_pos, 'UTF-8');
|
486 |
}
|
487 |
-
}else{
|
488 |
-
if( strlen($content) > $limit_content ){ // limiting content
|
489 |
$pos = strpos($content, ' ', $limit_content); // find first space position
|
490 |
if ($pos !== false) {
|
491 |
$first_space_pos = $pos;
|
492 |
-
}else{
|
493 |
$first_space_pos = $limit_content;
|
494 |
}
|
495 |
$content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
|
@@ -505,8 +472,6 @@ if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
|
505 |
if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
|
506 |
function pagelist_unqprfx_get_first_image( $content='' ) {
|
507 |
$first_img = '';
|
508 |
-
//ob_start();
|
509 |
-
//ob_end_clean();
|
510 |
$matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
511 |
if ( $matchCount !== 0 ) { // if we found first image
|
512 |
$first_img = $matches[1][0];
|
3 |
Plugin Name: Page-list
|
4 |
Plugin URI: http://wordpress.org/plugins/page-list/
|
5 |
Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
6 |
+
Version: 5.0
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
+
define('PAGE_LIST_VERSION', '5.0');
|
13 |
+
|
14 |
+
$pagelist_unq_settings = array(
|
15 |
+
'version' => PAGE_LIST_VERSION,
|
16 |
+
'powered_by' => "\n".'<!-- Page-list plugin v.'.PAGE_LIST_VERSION.' wordpress.org/plugins/page-list/ -->'."\n",
|
17 |
+
'page_list_defaults' => array(
|
18 |
+
'depth' => '0',
|
19 |
+
'child_of' => '0',
|
20 |
+
'exclude' => '0',
|
21 |
+
'exclude_tree' => '',
|
22 |
+
'include' => '0',
|
23 |
+
'title_li' => '',
|
24 |
+
'number' => '',
|
25 |
+
'offset' => '',
|
26 |
+
'meta_key' => '',
|
27 |
+
'meta_value' => '',
|
28 |
+
'show_date' => '',
|
29 |
+
'date_format' => get_option('date_format'),
|
30 |
+
'authors' => '',
|
31 |
+
'sort_column' => 'menu_order, post_title',
|
32 |
+
'sort_order' => 'ASC',
|
33 |
+
'link_before' => '',
|
34 |
+
'link_after' => '',
|
35 |
+
'post_type' => 'page',
|
36 |
+
'post_status' => 'publish',
|
37 |
+
'class' => ''
|
38 |
+
)
|
39 |
+
);
|
40 |
+
|
41 |
+
|
42 |
if ( !function_exists('pagelist_unqprfx_add_stylesheet') ) {
|
43 |
function pagelist_unqprfx_add_stylesheet() {
|
44 |
+
wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, PAGE_LIST_VERSION, 'all' );
|
45 |
}
|
46 |
add_action('wp_enqueue_scripts', 'pagelist_unqprfx_add_stylesheet');
|
47 |
}
|
48 |
|
49 |
|
|
|
|
|
|
|
50 |
if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
51 |
function pagelist_unqprfx_shortcode( $atts ) {
|
52 |
+
global $post, $pagelist_unq_settings;
|
53 |
$return = '';
|
54 |
+
extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
$page_list_args = array(
|
57 |
'depth' => $depth,
|
65 |
'meta_key' => $meta_key,
|
66 |
'meta_value' => $meta_value,
|
67 |
'show_date' => $show_date,
|
68 |
+
'date_format' => $date_format,
|
69 |
'echo' => 0,
|
70 |
+
'authors' => $authors,
|
71 |
'sort_column' => $sort_column,
|
72 |
'sort_order' => $sort_order,
|
73 |
'link_before' => $link_before,
|
74 |
'link_after' => $link_after,
|
75 |
+
'post_type' => $post_type,
|
76 |
+
'post_status' => $post_status
|
77 |
);
|
78 |
$list_pages = wp_list_pages( $page_list_args );
|
79 |
|
80 |
+
$return .= $pagelist_unq_settings['powered_by'];
|
81 |
if ($list_pages) {
|
82 |
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
83 |
+
} else {
|
84 |
$return .= '<!-- no pages to show -->';
|
85 |
}
|
86 |
return $return;
|
94 |
|
95 |
if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
96 |
function subpages_unqprfx_shortcode( $atts ) {
|
97 |
+
global $post, $pagelist_unq_settings;
|
98 |
$return = '';
|
99 |
+
extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
$page_list_args = array(
|
102 |
'depth' => $depth,
|
110 |
'meta_key' => $meta_key,
|
111 |
'meta_value' => $meta_value,
|
112 |
'show_date' => $show_date,
|
113 |
+
'date_format' => $date_format,
|
114 |
'echo' => 0,
|
115 |
+
'authors' => $authors,
|
116 |
'sort_column' => $sort_column,
|
117 |
'sort_order' => $sort_order,
|
118 |
'link_before' => $link_before,
|
119 |
'link_after' => $link_after,
|
120 |
+
'post_type' => $post_type,
|
121 |
+
'post_status' => $post_status
|
122 |
);
|
123 |
$list_pages = wp_list_pages( $page_list_args );
|
124 |
|
125 |
+
$return .= $pagelist_unq_settings['powered_by'];
|
126 |
if ($list_pages) {
|
127 |
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
128 |
+
} else {
|
129 |
$return .= '<!-- no pages to show -->';
|
130 |
}
|
131 |
return $return;
|
137 |
|
138 |
if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
139 |
function siblings_unqprfx_shortcode( $atts ) {
|
140 |
+
global $post, $pagelist_unq_settings;
|
141 |
$return = '';
|
142 |
+
extract( shortcode_atts( $pagelist_unq_settings['page_list_defaults'], $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
+
if ( $exclude == 'current' || $exclude == 'this' ) {
|
145 |
$exclude = $post->ID;
|
146 |
}
|
147 |
|
157 |
'meta_key' => $meta_key,
|
158 |
'meta_value' => $meta_value,
|
159 |
'show_date' => $show_date,
|
160 |
+
'date_format' => $date_format,
|
161 |
'echo' => 0,
|
162 |
+
'authors' => $authors,
|
163 |
'sort_column' => $sort_column,
|
164 |
'sort_order' => $sort_order,
|
165 |
'link_before' => $link_before,
|
166 |
'link_after' => $link_after,
|
167 |
+
'post_type' => $post_type,
|
168 |
+
'post_status' => $post_status
|
169 |
);
|
170 |
$list_pages = wp_list_pages( $page_list_args );
|
171 |
|
172 |
+
$return .= $pagelist_unq_settings['powered_by'];
|
173 |
if ($list_pages) {
|
174 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
175 |
+
} else {
|
176 |
$return .= '<!-- no pages to show -->';
|
177 |
}
|
178 |
return $return;
|
183 |
|
184 |
if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
185 |
function pagelist_unqprfx_ext_shortcode( $atts ) {
|
186 |
+
global $post, $pagelist_unq_settings;
|
187 |
$return = '';
|
188 |
extract( shortcode_atts( array(
|
189 |
'show_image' => 1,
|
218 |
'meta_template' => '%meta%'
|
219 |
), $atts ) );
|
220 |
|
221 |
+
if ( $child_of == '' ) { // show subpages if child_of is empty
|
222 |
$child_of = $post->ID;
|
223 |
}
|
224 |
|
231 |
'limit_content' => $limit_content,
|
232 |
'image_width' => $image_width,
|
233 |
'image_height' => $image_height,
|
|
|
234 |
'sort_order' => $sort_order,
|
235 |
'sort_column' => $sort_column,
|
236 |
'hierarchical' => $hierarchical,
|
237 |
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
238 |
'include' => $include,
|
239 |
+
'meta_key' => $meta_key,
|
240 |
+
'meta_value' => $meta_value,
|
241 |
'authors' => $authors,
|
242 |
+
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
243 |
'parent' => pagelist_unqprfx_norm_params($parent),
|
244 |
'exclude_tree' => $exclude_tree,
|
245 |
'number' => '', // $number - own counter
|
263 |
'limit_content' => $limit_content,
|
264 |
'image_width' => $image_width,
|
265 |
'image_height' => $image_height,
|
|
|
266 |
'sort_order' => $sort_order,
|
267 |
'sort_column' => $sort_column,
|
268 |
'hierarchical' => $hierarchical,
|
269 |
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
270 |
'include' => $include,
|
271 |
+
'meta_key' => $meta_key,
|
272 |
+
'meta_value' => $meta_value,
|
273 |
'authors' => $authors,
|
274 |
+
'child_of' => 0, // for showing all pages
|
275 |
'parent' => pagelist_unqprfx_norm_params($parent),
|
276 |
'exclude_tree' => $exclude_tree,
|
277 |
'number' => '', // $number - own counter
|
287 |
'meta_template' => $meta_template
|
288 |
);
|
289 |
$list_pages = get_pages( $page_list_ext_args );
|
290 |
+
if ( count( $list_pages ) == 0 ) { // if there is no subpages
|
291 |
$list_pages = get_pages( $page_list_ext_args_all ); // we are showing all pages
|
292 |
}
|
293 |
$list_pages_html = '';
|
294 |
$count = 0;
|
295 |
$offset_count = 0;
|
296 |
+
if ( $list_pages !== false && count( $list_pages ) > 0 ) {
|
297 |
foreach($list_pages as $page){
|
298 |
$count++;
|
299 |
$offset_count++;
|
304 |
if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
|
305 |
$link = get_permalink( $page->ID );
|
306 |
$list_pages_html .= '<div class="page-list-ext-item">';
|
307 |
+
if ( $show_image == 1 ) {
|
308 |
+
if ( get_the_post_thumbnail( $page->ID ) ) { // if there is a featured image
|
309 |
+
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
310 |
+
//$list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height)); // doesn't work good with image size
|
311 |
+
|
312 |
+
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), array($image_width,$image_height) ); // get featured img; 'large'
|
313 |
+
$img_url = $image[0]; // get the src of the featured image
|
314 |
+
$list_pages_html .= '<img src="'.$img_url.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
315 |
+
|
316 |
+
$list_pages_html .= '</a></div> ';
|
317 |
+
} else {
|
318 |
+
if ( $show_first_image == 1 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
320 |
+
if ( !empty( $img_scr ) ) {
|
321 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
322 |
+
$list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
323 |
$list_pages_html .= '</a></div> ';
|
324 |
}
|
325 |
}
|
327 |
}
|
328 |
|
329 |
|
330 |
+
if ( $show_title == 1 ) {
|
331 |
$list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
|
332 |
}
|
333 |
+
if ( $show_content == 1 ) {
|
334 |
//$content = apply_filters('the_content', $page->post_content);
|
335 |
//$content = str_replace(']]>', ']]>', $content); // both used in default the_content() function
|
336 |
|
337 |
+
if ( !empty( $page->post_excerpt ) ) {
|
338 |
$text_content = $page->post_excerpt;
|
339 |
+
} else {
|
340 |
$text_content = $page->post_content;
|
341 |
}
|
342 |
|
343 |
if ( post_password_required($page) ) {
|
344 |
$content = '<!-- password protected -->';
|
345 |
+
} else {
|
346 |
$content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
|
347 |
$content = do_shortcode( $content );
|
348 |
|
349 |
+
if ( $show_title == 0 ) { // make content as a link if there is no title
|
350 |
$content = '<a href="'.$link.'">'.$content.'</a>';
|
351 |
}
|
352 |
}
|
354 |
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
|
355 |
|
356 |
}
|
357 |
+
if ( $show_child_count == 1 ) {
|
358 |
$count_subpages = count(get_pages("child_of=".$page->ID));
|
359 |
+
if ( $count_subpages > 0 ) { // hide empty
|
360 |
$child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
|
361 |
+
if ($child_count_pos === false) { // %child_count% not found in template
|
362 |
+
$child_count_template_html = $child_count_template.' '.$count_subpages;
|
363 |
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
364 |
} else { // %child_count% found in template
|
365 |
+
$child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
|
366 |
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
367 |
}
|
368 |
}
|
369 |
}
|
370 |
+
if ( $show_meta_key != '' ) {
|
371 |
$post_meta = get_post_meta($page->ID, $show_meta_key, true);
|
372 |
+
if ( !empty($post_meta) ) { // hide empty
|
373 |
$meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
|
374 |
+
if ($meta_pos === false) { // %meta% not found in template
|
375 |
+
$meta_template_html = $meta_template.' '.$post_meta;
|
376 |
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
377 |
} else { // %meta% found in template
|
378 |
+
$meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
|
379 |
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
380 |
}
|
381 |
}
|
385 |
}
|
386 |
}
|
387 |
}
|
388 |
+
$return .= $pagelist_unq_settings['powered_by'];
|
389 |
if ($list_pages_html) {
|
390 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
391 |
+
} else {
|
392 |
$return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
|
393 |
}
|
394 |
return $return;
|
415 |
function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
|
416 |
|
417 |
$more_tag_found = 0;
|
|
|
418 |
|
419 |
+
if ( $more_tag ) { // "more_tag" have higher priority than "limit_content"
|
420 |
if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
|
421 |
$more_tag_found = 1;
|
422 |
$more_tag = $matches[0];
|
432 |
//$content = preg_replace("@<!--@", "#!--#", $content); // save html comments
|
433 |
// strip tags normally
|
434 |
//$content = strip_tags($content);
|
435 |
+
if ( $strip_tags ) {
|
436 |
$content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
|
437 |
$content = strip_tags($content); // ,'<p>'
|
438 |
}
|
440 |
//$content = preg_replace("@#\?#@", "<?", $content);
|
441 |
//$content = preg_replace("@#!--#@", "<!--", $content);
|
442 |
|
443 |
+
if ( $strip_shortcodes ) {
|
444 |
$content = strip_shortcodes( $content );
|
445 |
}
|
446 |
|
447 |
+
if ( $more_tag && $more_tag_found ) { // "more_tag" have higher priority than "limit_content"
|
448 |
$fake_more_pos = mb_strpos($content, '###more###', 0, 'UTF-8');
|
449 |
+
if ( $fake_more_pos === false ) {
|
450 |
// substring not found in string and this is strange :)
|
451 |
} else {
|
452 |
$content = mb_substr($content, 0, $fake_more_pos, 'UTF-8');
|
453 |
}
|
454 |
+
} else {
|
455 |
+
if ( strlen($content) > $limit_content ) { // limiting content
|
456 |
$pos = strpos($content, ' ', $limit_content); // find first space position
|
457 |
if ($pos !== false) {
|
458 |
$first_space_pos = $pos;
|
459 |
+
} else {
|
460 |
$first_space_pos = $limit_content;
|
461 |
}
|
462 |
$content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
|
472 |
if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
|
473 |
function pagelist_unqprfx_get_first_image( $content='' ) {
|
474 |
$first_img = '';
|
|
|
|
|
475 |
$matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
476 |
if ( $matchCount !== 0 ) { // if we found first image
|
477 |
$first_img = $matches[1][0];
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-profile.com.ua/donate/
|
|
4 |
Tags: page, page-list, pagelist, sitemap, subpages, siblings
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag:
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -14,7 +14,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
14 |
|
15 |
> **[WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)** |
|
16 |
> **[Page-list](http://web-profile.com.ua/wordpress/plugins/page-list/ "Plugin page")** |
|
17 |
-
> **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/)** |
|
18 |
> **[Donate](http://web-profile.com.ua/donate/ "Support the development")**
|
19 |
|
20 |
= shortcodes: =
|
@@ -28,7 +28,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
28 |
|
29 |
* `[pagelist child_of="4" depth="2" exclude="6,7,8"]`
|
30 |
* `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
|
31 |
-
* **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/)**
|
32 |
|
33 |
= Useful: =
|
34 |
* ["Anti-spam" - block spam in comments](http://wordpress.org/plugins/anti-spam/ "no spam, no captcha")
|
@@ -38,24 +38,30 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
38 |
== Other Notes ==
|
39 |
|
40 |
= Parameters for [pagelist], [subpages] and [siblings]: =
|
41 |
-
* **[pagelist]** -
|
42 |
-
* **[subpages]** -
|
43 |
-
* **[siblings]** -
|
44 |
-
* **depth** -
|
45 |
-
* **child_of** -
|
46 |
-
* **exclude** -
|
47 |
-
* **exclude_tree** -
|
48 |
-
* **include** -
|
49 |
-
* **title_li** -
|
50 |
-
* **
|
51 |
-
* **
|
52 |
-
* **
|
53 |
-
* **
|
54 |
-
* **
|
55 |
-
* **
|
56 |
-
* **
|
57 |
-
* **
|
58 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
= Parameters for [pagelist_ext]: =
|
61 |
* **[pagelist_ext]** - by default shows list of subpages to current page; but if there is no subpages than all pages will be shown;
|
@@ -63,32 +69,33 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
63 |
* **show_first_image** - show or hide first image from content if there is no featured image `[pagelist_ext show_first_image="1"]`; by default: show_first_image="0";
|
64 |
* **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
|
65 |
* **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
|
66 |
-
* **more_tag** -
|
67 |
* **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";
|
68 |
* **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="50";
|
69 |
* **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="50";
|
70 |
-
* **child_of** -
|
71 |
-
* **parent** -
|
72 |
-
* **
|
73 |
-
* **
|
74 |
* **hierarchical** - display subpages below their parent page `[pagelist_ext hierarchical="0"]`; by default: hierarchical="1";
|
75 |
-
* **exclude** -
|
76 |
-
* **exclude_tree** -
|
77 |
-
* **include** -
|
78 |
-
* **meta_key**
|
79 |
* **authors** - only include the pages written by the given author(s) `[pagelist_ext authors="6,7,8"]`;
|
80 |
-
* **number** -
|
81 |
-
* **offset** -
|
82 |
-
* **post_type** - `[pagelist_ext post_type="page"]`;
|
83 |
-
* **post_status** - `[pagelist_ext post_status="
|
84 |
-
* **class** -
|
85 |
-
* **strip_tags** -
|
86 |
-
* **strip_shortcodes** -
|
87 |
-
* **show_child_count** -
|
88 |
-
* **child_count_template** -
|
89 |
-
* **show_meta_key** -
|
90 |
-
* **meta_template** -
|
91 |
-
|
|
|
92 |
|
93 |
== Frequently Asked Questions ==
|
94 |
|
@@ -98,7 +105,7 @@ To show list of posts you can use [List Category Posts](http://wordpress.org/plu
|
|
98 |
|
99 |
= On what functions shortcodes are based? =
|
100 |
|
101 |
-
Shortcodes [pagelist], [subpages], [siblings] are based on [wp_list_pages(
|
102 |
Shortcode [pagelist_ext] is based on [get_pages()](http://codex.wordpress.org/Function_Reference/get_pages) function.
|
103 |
|
104 |
= What is the difference between [pagelist], [subpages] and [siblings]? =
|
@@ -109,7 +116,7 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
|
|
109 |
To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/plugins/google-sitemap-generator/) plugin.
|
110 |
|
111 |
= Is there "more-link" feature in the plugin? =
|
112 |
-
No, there is no "more-link" feature in the plugin. Because "[more-link](http://web-profile.com.ua/web/web-principles/more-link/)":
|
113 |
|
114 |
* **bad for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
|
115 |
* **bad for usability.** There is already link on title and "more-link" is an extra no needed element on page. If user cannot understand that the title is the link, than there is a problem in css styles and not in plugin's templates.
|
@@ -124,6 +131,11 @@ When you changed the plugin's code you should also change the plugin's version t
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
= 4.3 - 2015.01.15 =
|
128 |
* use wp_enqueue_scripts hook instead of wp_print_styles to enqueue scripts and styles (thanks to sireneweb)
|
129 |
|
4 |
Tags: page, page-list, pagelist, sitemap, subpages, siblings
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 5.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
14 |
|
15 |
> **[WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)** |
|
16 |
> **[Page-list](http://web-profile.com.ua/wordpress/plugins/page-list/ "Plugin page")** |
|
17 |
+
> **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")** |
|
18 |
> **[Donate](http://web-profile.com.ua/donate/ "Support the development")**
|
19 |
|
20 |
= shortcodes: =
|
28 |
|
29 |
* `[pagelist child_of="4" depth="2" exclude="6,7,8"]`
|
30 |
* `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
|
31 |
+
* **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/ "Page-list params")**
|
32 |
|
33 |
= Useful: =
|
34 |
* ["Anti-spam" - block spam in comments](http://wordpress.org/plugins/anti-spam/ "no spam, no captcha")
|
38 |
== Other Notes ==
|
39 |
|
40 |
= Parameters for [pagelist], [subpages] and [siblings]: =
|
41 |
+
* **[pagelist]** - list of all pages as the hierarchical list;
|
42 |
+
* **[subpages]** - list of subpages to the current page as the hierarchical list; Same as: `[pagelist child_of="current"]`;
|
43 |
+
* **[siblings]** - list of sibling pages to the current page as the hierarchical list; Same as: `[pagelist child_of="parent"]`;
|
44 |
+
* **depth** - how many levels in the hierarchy of pages are to be included in the list: `[pagelist depth="3"]`; by default depth is unlimited (depth="0"); Displays pages at any depth and arranges them in a flat list: `[pagelist depth="-1"]`;
|
45 |
+
* **child_of** - displays the sub-pages of a single Page by ID: `[pagelist child_of="4"]`;
|
46 |
+
* **exclude** - define a comma-separated list of Page IDs to be excluded from the list: `[pagelist exclude="6,7,8"]`; You may exclude current page: `[pagelist exclude="current"]`;
|
47 |
+
* **exclude_tree** - define a comma-separated list of parent Page IDs and all its subpages to be excluded: `[pagelist exclude_tree="7,10"]`;
|
48 |
+
* **include** - include a comma-separated list of Page IDs into the list: `[pagelist include="6,7,8"]`;
|
49 |
+
* **title_li** - set the text and style of the Page list's heading: `[pagelist title_li="<h2>List of pages</h2>"]`; by default there is no title (title_li="");
|
50 |
+
* **authors** - only include pages authored by the authors in this comma-separated list of author IDs: `[pagelist authors="2,5"]`; by default all authors are included (authors="");
|
51 |
+
* **number** - sets the number of pages to display: `[pagelist number="10"]`; by default the number is unlimited (number="");
|
52 |
+
* **offset** - the number of pages to pass over (or displace) before collecting the set of pages: `[pagelist offset="5"]`; by default there is no offset (offset="");
|
53 |
+
* **post_type** - list associated with a certain hierarchical Post Type `[pagelist post_type="page"]`; by default: (post_type="page"); possible values: page, revision, Hierarchical Custom Post Types ('post' is not a Hierarchical Post Type);
|
54 |
+
* **post_status** - a comma-separated list of all post status types: `[pagelist post_status="private"]`; by default: (post_status="publish"); possible values: publish, private, draft;
|
55 |
+
* **meta_key** and **meta_value** - only include the pages that have this Custom Field Key and this Custom Field Value: `[pagelist meta_key="metakey" meta_value="metaval"]`;
|
56 |
+
* **show_date** - display creation or last modified date next to each Page: `[pagelist show_date="created"]`; possible values: created, modified, updated;
|
57 |
+
* **date_format** - the format of the Page date set by the show_date parameter: `[pagelist date_format="l, F j, Y"]`; by default use the date format configured in your WordPress options;
|
58 |
+
* **sort_column** - sort the list of pages by column: `[pagelist sort_column="menu_order"]`; by default: (sort_column="menu_order, post_title"); possible values: post_title, menu_order, post_date (sort by creation time), post_modified, ID, post_author, post_name (sort by page slug);
|
59 |
+
* **sort_order** - the sort order of the list of pages (either ascending or descending): `[pagelist sort_order="desc"]`; by default: (sort_order="asc"); possible values: asc, desc;
|
60 |
+
* **link_before** - sets the text or html that precedes the link text inside link tag: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
|
61 |
+
* **link_after** - sets the text or html that follows the link text inside link tag: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
|
62 |
+
* **class** - the CSS class for list of pages: `[pagelist class="listclass"]`; by default the class is empty (class="");
|
63 |
+
|
64 |
+
More [info about params](http://codex.wordpress.org/Function_Reference/wp_list_pages#Parameters) for [pagelist], [subpages], [siblings].
|
65 |
|
66 |
= Parameters for [pagelist_ext]: =
|
67 |
* **[pagelist_ext]** - by default shows list of subpages to current page; but if there is no subpages than all pages will be shown;
|
69 |
* **show_first_image** - show or hide first image from content if there is no featured image `[pagelist_ext show_first_image="1"]`; by default: show_first_image="0";
|
70 |
* **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
|
71 |
* **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
|
72 |
+
* **more_tag** - output all content before and after more tag: `[pagelist_ext more_tag="0"]`; this parameter does not add "more-link" to the end of content, it just cut content before more-tag; "more_tag" parameter have higher priority than "limit_content"; by default the more_tag is enabled (more_tag="1") and showing only content before more tag;
|
73 |
* **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";
|
74 |
* **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="50";
|
75 |
* **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="50";
|
76 |
+
* **child_of** - displays the sub-pages of a single Page by ID: `[pagelist_ext child_of="4"]`; by default it shows subpages to the current page;
|
77 |
+
* **parent** - list those pages that have the provided single page only ID as parent: `[pagelist_ext parent="4"]`; by default parent="-1" and depth is unlimited;
|
78 |
+
* **sort_column** - sort the list of pages by column: `[pagelist_ext sort_column="menu_order"]`; by default: (sort_column="menu_order, post_title"); possible values: post_title, menu_order, post_date (sort by creation time), post_modified, ID, post_author, post_name (sort by page slug);
|
79 |
+
* **sort_order** - the sort order of the list of pages (either ascending or descending): `[pagelist_ext sort_order="desc"]`; by default: (sort_order="asc"); possible values: asc, desc;* **hierarchical** - display subpages below their parent page `[pagelist_ext hierarchical="0"]`; by default: hierarchical="1";
|
80 |
* **hierarchical** - display subpages below their parent page `[pagelist_ext hierarchical="0"]`; by default: hierarchical="1";
|
81 |
+
* **exclude** - define a comma-separated list of Page IDs to be excluded from the list: `[pagelist_ext exclude="6,7,8"]`;
|
82 |
+
* **exclude_tree** - define a comma-separated list of parent Page IDs and all its subpages to be excluded: `[pagelist_ext exclude_tree="7,10"]`;
|
83 |
+
* **include** - include a comma-separated list of Page IDs into the list: `[pagelist_ext include="6,7,8"]`;
|
84 |
+
* **meta_key** and **meta_value** - only include the pages that have this Custom Field Key and this Custom Field Value: `[pagelist_ext meta_key="metakey" meta_value="metaval"]`;
|
85 |
* **authors** - only include the pages written by the given author(s) `[pagelist_ext authors="6,7,8"]`;
|
86 |
+
* **number** - sets the number of pages to display: `[pagelist_ext number="10"]`; by default the number is unlimited (number="");
|
87 |
+
* **offset** - the number of pages to pass over (or displace) before collecting the set of pages: `[pagelist_ext offset="5"]`; by default there is no offset (offset="");
|
88 |
+
* **post_type** - list associated with a certain hierarchical Post Type `[pagelist_ext post_type="page"]`; by default: (post_type="page"); possible values: page, revision, Hierarchical Custom Post Types ('post' is not a Hierarchical Post Type);
|
89 |
+
* **post_status** - a comma-separated list of all post status types: `[pagelist_ext post_status="private"]`; by default: (post_status="publish"); possible values: publish, private, draft;
|
90 |
+
* **class** - the CSS class for list of pages: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
|
91 |
+
* **strip_tags** - strip tags or not: `[pagelist_ext strip_tags="0"]`; by default the tags are stripped (strip_tags="1");
|
92 |
+
* **strip_shortcodes** - strip registered shortcodes or not: `[pagelist_ext strip_shortcodes="0"]`; by default shortcodes are stripped (strip_shortcodes="1") and all registered shortcodes are removed;
|
93 |
+
* **show_child_count** - show count of subpages: `[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 shown;
|
94 |
+
* **child_count_template** - the template of child_count: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
|
95 |
+
* **show_meta_key** - show or hide meta key: `[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 shown;
|
96 |
+
* **meta_template** - the template of meta: `[pagelist_ext show_meta_key="your_meta_key" meta_template="Meta: %meta%"]`; by default meta_template="%meta%";
|
97 |
+
|
98 |
+
More [info about params](http://codex.wordpress.org/Function_Reference/get_pages#Parameters) for [pagelist_ext].
|
99 |
|
100 |
== Frequently Asked Questions ==
|
101 |
|
105 |
|
106 |
= On what functions shortcodes are based? =
|
107 |
|
108 |
+
Shortcodes [pagelist], [subpages], [siblings] are based on [wp_list_pages()](http://codex.wordpress.org/Template_Tags/wp_list_pages) function.
|
109 |
Shortcode [pagelist_ext] is based on [get_pages()](http://codex.wordpress.org/Function_Reference/get_pages) function.
|
110 |
|
111 |
= What is the difference between [pagelist], [subpages] and [siblings]? =
|
116 |
To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/plugins/google-sitemap-generator/) plugin.
|
117 |
|
118 |
= Is there "more-link" feature in the plugin? =
|
119 |
+
No, there is no "more-link" feature in the plugin. Because "[more-link](http://web-profile.com.ua/web/web-principles/more-link/ "do not use more-link")":
|
120 |
|
121 |
* **bad for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
|
122 |
* **bad for usability.** There is already link on title and "more-link" is an extra no needed element on page. If user cannot understand that the title is the link, than there is a problem in css styles and not in plugin's templates.
|
131 |
|
132 |
== Changelog ==
|
133 |
|
134 |
+
= 5.0 - 2015.01.25 =
|
135 |
+
* code refactor
|
136 |
+
* update docs
|
137 |
+
* added 'authors', 'post_type', 'post_status', 'date_format' params to [pagelist], [subpages], [siblings] shortcodes (thanks to Nick Ciske)
|
138 |
+
|
139 |
= 4.3 - 2015.01.15 =
|
140 |
* use wp_enqueue_scripts hook instead of wp_print_styles to enqueue scripts and styles (thanks to sireneweb)
|
141 |
|