Version Description
- added "strip_shortcodes" parameter;
Download this release
Release Info
Developer | webvitaly |
Plugin | Page-list |
Version | 2.8 |
Comparing to | |
See all releases |
Code changes from version 2.6 to 2.8
- page-list.php +40 -38
- readme.txt +27 -20
page-list.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Page-list
|
4 |
Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
|
5 |
Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
|
6 |
-
Version: 2.
|
7 |
Author: webvitaly
|
8 |
Author Email: webvitaly(at)gmail.com
|
9 |
Author URI: http://web-profile.com.ua/wordpress/
|
@@ -14,14 +14,16 @@ Future features:
|
|
14 |
- exclude_post_page;
|
15 |
*/
|
16 |
|
17 |
-
add_action('wp_print_styles', '
|
18 |
-
function
|
19 |
-
wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '2.
|
20 |
}
|
21 |
|
|
|
|
|
22 |
if ( !function_exists('pagelist_shortcode') ) {
|
23 |
function pagelist_shortcode( $atts ) {
|
24 |
-
global $post;
|
25 |
$return = '';
|
26 |
extract( shortcode_atts( array(
|
27 |
'depth' => '0',
|
@@ -66,7 +68,7 @@ if ( !function_exists('pagelist_shortcode') ) {
|
|
66 |
$list_pages = wp_list_pages( $page_list_args );
|
67 |
|
68 |
if ($list_pages) {
|
69 |
-
$return =
|
70 |
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
71 |
}else{
|
72 |
$return = '';
|
@@ -81,7 +83,7 @@ if ( !function_exists('pagelist_shortcode') ) {
|
|
81 |
|
82 |
if ( !function_exists('subpages_shortcode') ) {
|
83 |
function subpages_shortcode( $atts ) {
|
84 |
-
global $post;
|
85 |
$return = '';
|
86 |
extract( shortcode_atts( array(
|
87 |
'depth' => '0',
|
@@ -126,7 +128,7 @@ if ( !function_exists('subpages_shortcode') ) {
|
|
126 |
$list_pages = wp_list_pages( $page_list_args );
|
127 |
|
128 |
if ($list_pages) {
|
129 |
-
$return =
|
130 |
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
131 |
}else{
|
132 |
$return = '';
|
@@ -141,7 +143,7 @@ if ( !function_exists('subpages_shortcode') ) {
|
|
141 |
|
142 |
if ( !function_exists('siblings_shortcode') ) {
|
143 |
function siblings_shortcode( $atts ) {
|
144 |
-
global $post;
|
145 |
$return = '';
|
146 |
extract( shortcode_atts( array(
|
147 |
'depth' => '0',
|
@@ -190,7 +192,7 @@ if ( !function_exists('siblings_shortcode') ) {
|
|
190 |
$list_pages = wp_list_pages( $page_list_args );
|
191 |
|
192 |
if ($list_pages) {
|
193 |
-
$return =
|
194 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
195 |
}else{
|
196 |
$return = '';
|
@@ -202,7 +204,7 @@ if ( !function_exists('siblings_shortcode') ) {
|
|
202 |
|
203 |
if ( !function_exists('pagelist_ext_shortcode') ) {
|
204 |
function pagelist_ext_shortcode( $atts ) {
|
205 |
-
global $post;
|
206 |
$return = '';
|
207 |
extract( shortcode_atts( array(
|
208 |
'show_image' => 1,
|
@@ -228,6 +230,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
228 |
'post_status' => 'publish',
|
229 |
'class' => '',
|
230 |
'strip_tags' => 1,
|
|
|
231 |
'show_child_count' => 0,
|
232 |
'child_count_template' => 'Subpages: %child_count%',
|
233 |
'show_meta_key' => '',
|
@@ -262,6 +265,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
262 |
'post_status' => $post_status,
|
263 |
'class' => $class,
|
264 |
'strip_tags' => $strip_tags,
|
|
|
265 |
'show_child_count' => $show_child_count,
|
266 |
'child_count_template' => $child_count_template,
|
267 |
'show_meta_key' => $show_meta_key,
|
@@ -301,8 +305,12 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
301 |
}else{
|
302 |
$text_content = $page->post_content;
|
303 |
}
|
304 |
-
$content = page_list_parse_content( $text_content, $limit_content, $strip_tags );
|
|
|
|
|
|
|
305 |
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
|
|
|
306 |
}
|
307 |
if( $show_child_count == 1 ){
|
308 |
$count_subpages = count(get_pages("child_of=".$page->ID));
|
@@ -335,7 +343,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
335 |
}
|
336 |
}
|
337 |
if ($list_pages_html) {
|
338 |
-
$return =
|
339 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
340 |
}else{
|
341 |
$return = '';
|
@@ -358,35 +366,29 @@ if ( !function_exists('pagelist_norm_params') ) {
|
|
358 |
}
|
359 |
|
360 |
if ( !function_exists('page_list_parse_content') ) {
|
361 |
-
function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1) {
|
362 |
$output = '';
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
$first_space_pos = $pos;
|
378 |
-
}else{
|
379 |
-
$first_space_pos = $limit_content;
|
380 |
-
}
|
381 |
-
$content_cut = mb_substr($content_stripped, 0, $first_space_pos,'UTF-8');
|
382 |
-
$content = $content_cut.'...';
|
383 |
}else{
|
384 |
-
$
|
385 |
}
|
386 |
-
$content =
|
387 |
}
|
388 |
-
|
389 |
-
$output = force_balance_tags($
|
390 |
return $output;
|
391 |
}
|
392 |
}
|
3 |
Plugin Name: Page-list
|
4 |
Plugin URI: http://web-profile.com.ua/wordpress/plugins/page-list/
|
5 |
Description: Show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
|
6 |
+
Version: 2.8
|
7 |
Author: webvitaly
|
8 |
Author Email: webvitaly(at)gmail.com
|
9 |
Author URI: http://web-profile.com.ua/wordpress/
|
14 |
- exclude_post_page;
|
15 |
*/
|
16 |
|
17 |
+
add_action('wp_print_styles', 'pagelist_add_stylesheet');
|
18 |
+
function pagelist_add_stylesheet() {
|
19 |
+
wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '2.8', 'all' );
|
20 |
}
|
21 |
|
22 |
+
$pagelist_powered_line = "\n".'<!-- powered by Page-list plugin ver.2.8 (wordpress.org/extend/plugins/page-list/) -->'."\n";
|
23 |
+
|
24 |
if ( !function_exists('pagelist_shortcode') ) {
|
25 |
function pagelist_shortcode( $atts ) {
|
26 |
+
global $post, $pagelist_powered_line;
|
27 |
$return = '';
|
28 |
extract( shortcode_atts( array(
|
29 |
'depth' => '0',
|
68 |
$list_pages = wp_list_pages( $page_list_args );
|
69 |
|
70 |
if ($list_pages) {
|
71 |
+
$return = $pagelist_powered_line;
|
72 |
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
73 |
}else{
|
74 |
$return = '';
|
83 |
|
84 |
if ( !function_exists('subpages_shortcode') ) {
|
85 |
function subpages_shortcode( $atts ) {
|
86 |
+
global $post, $pagelist_powered_line;
|
87 |
$return = '';
|
88 |
extract( shortcode_atts( array(
|
89 |
'depth' => '0',
|
128 |
$list_pages = wp_list_pages( $page_list_args );
|
129 |
|
130 |
if ($list_pages) {
|
131 |
+
$return = $pagelist_powered_line;
|
132 |
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
133 |
}else{
|
134 |
$return = '';
|
143 |
|
144 |
if ( !function_exists('siblings_shortcode') ) {
|
145 |
function siblings_shortcode( $atts ) {
|
146 |
+
global $post, $pagelist_powered_line;
|
147 |
$return = '';
|
148 |
extract( shortcode_atts( array(
|
149 |
'depth' => '0',
|
192 |
$list_pages = wp_list_pages( $page_list_args );
|
193 |
|
194 |
if ($list_pages) {
|
195 |
+
$return = $pagelist_powered_line;
|
196 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
197 |
}else{
|
198 |
$return = '';
|
204 |
|
205 |
if ( !function_exists('pagelist_ext_shortcode') ) {
|
206 |
function pagelist_ext_shortcode( $atts ) {
|
207 |
+
global $post, $pagelist_powered_line;
|
208 |
$return = '';
|
209 |
extract( shortcode_atts( array(
|
210 |
'show_image' => 1,
|
230 |
'post_status' => 'publish',
|
231 |
'class' => '',
|
232 |
'strip_tags' => 1,
|
233 |
+
'strip_shortcodes' => 1,
|
234 |
'show_child_count' => 0,
|
235 |
'child_count_template' => 'Subpages: %child_count%',
|
236 |
'show_meta_key' => '',
|
265 |
'post_status' => $post_status,
|
266 |
'class' => $class,
|
267 |
'strip_tags' => $strip_tags,
|
268 |
+
'strip_shortcodes' => $strip_shortcodes,
|
269 |
'show_child_count' => $show_child_count,
|
270 |
'child_count_template' => $child_count_template,
|
271 |
'show_meta_key' => $show_meta_key,
|
305 |
}else{
|
306 |
$text_content = $page->post_content;
|
307 |
}
|
308 |
+
$content = page_list_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes );
|
309 |
+
if( $show_title == 0 ){ // make excerpt link if there is no title
|
310 |
+
$content = '<a href="'.$link.'">'.$content.'</a>';
|
311 |
+
}
|
312 |
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
|
313 |
+
|
314 |
}
|
315 |
if( $show_child_count == 1 ){
|
316 |
$count_subpages = count(get_pages("child_of=".$page->ID));
|
343 |
}
|
344 |
}
|
345 |
if ($list_pages_html) {
|
346 |
+
$return = $pagelist_powered_line;
|
347 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
348 |
}else{
|
349 |
$return = '';
|
366 |
}
|
367 |
|
368 |
if ( !function_exists('page_list_parse_content') ) {
|
369 |
+
function page_list_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1) {
|
370 |
$output = '';
|
371 |
+
|
372 |
+
if( $strip_shortcodes ){
|
373 |
+
$content = strip_shortcodes( $content );
|
374 |
+
}
|
375 |
+
|
376 |
+
if( $strip_tags ){
|
377 |
+
$content = str_replace('</', ' </', $content); // <p>aaa</p><p>bbb</p> - adding space between lines
|
378 |
+
$content = strip_tags($content); // ,'<p>'
|
379 |
+
}
|
380 |
+
|
381 |
+
if( strlen($content) > $limit_content ){
|
382 |
+
$pos = strpos($content, ' ', $limit_content);
|
383 |
+
if ($pos !== false) {
|
384 |
+
$first_space_pos = $pos;
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
}else{
|
386 |
+
$first_space_pos = $limit_content;
|
387 |
}
|
388 |
+
$content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
|
389 |
}
|
390 |
+
|
391 |
+
$output = force_balance_tags($content);
|
392 |
return $output;
|
393 |
}
|
394 |
}
|
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.
|
9 |
|
10 |
"Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
|
11 |
|
@@ -72,6 +72,7 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
|
|
72 |
* **post_status** - `[pagelist_ext post_status="publish"]`;
|
73 |
* **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="");
|
74 |
* **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
|
|
|
75 |
* **show_child_count** - if you want to show child count you can use this shortcode: `[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 showing;
|
76 |
* **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
|
77 |
* **show_meta_key** - if you want to show meta key you can use this shortcode: `[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 showing;
|
@@ -84,56 +85,62 @@ You can use aditional parameters: **`[pagelist_ext child_of="4" exclude="6,7,8"
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
= 2.6 =
|
88 |
-
*
|
89 |
|
90 |
= 2.5 =
|
91 |
-
*
|
92 |
|
93 |
= 2.4 =
|
94 |
-
*
|
95 |
|
96 |
= 2.3 =
|
97 |
-
*
|
98 |
|
99 |
= 2.2 =
|
100 |
-
*
|
101 |
|
102 |
= 2.1 =
|
103 |
-
*
|
104 |
|
105 |
= 2.0 =
|
106 |
-
*
|
107 |
|
108 |
= 1.9 =
|
109 |
-
*
|
110 |
-
*
|
111 |
|
112 |
= 1.8 =
|
113 |
-
*
|
114 |
-
*
|
115 |
|
116 |
= 1.7 =
|
117 |
-
*
|
118 |
|
119 |
= 1.6 =
|
120 |
-
*
|
121 |
|
122 |
= 1.5 =
|
123 |
-
*
|
124 |
|
125 |
= 1.4 =
|
126 |
-
*
|
127 |
|
128 |
= 1.3.0 =
|
129 |
-
*
|
130 |
-
*
|
131 |
|
132 |
= 1.2.0 =
|
133 |
-
*
|
134 |
|
135 |
= 1.0.0 =
|
136 |
-
*
|
137 |
|
138 |
== Installation ==
|
139 |
|
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.8
|
9 |
|
10 |
"Page-list" plugin helps you to show list of pages with [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes.
|
11 |
|
72 |
* **post_status** - `[pagelist_ext post_status="publish"]`;
|
73 |
* **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="");
|
74 |
* **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
|
75 |
+
* **strip_shortcodes** - if you want to output the content with shortcode use this shortcode: `[pagelist_ext strip_shortcodes="0"]`; by default the strip_shortcodes is enabled (strip_shortcodes="1") and all registered shortcodes are removed;
|
76 |
* **show_child_count** - if you want to show child count you can use this shortcode: `[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 showing;
|
77 |
* **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
|
78 |
* **show_meta_key** - if you want to show meta key you can use this shortcode: `[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 showing;
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 2.8 =
|
89 |
+
* added "strip_shortcodes" parameter;
|
90 |
+
|
91 |
+
= 2.7 =
|
92 |
+
* make excerpt link if there is no title;
|
93 |
+
|
94 |
= 2.6 =
|
95 |
+
* fixed [pagelist_ext] "parent" parameter;
|
96 |
|
97 |
= 2.5 =
|
98 |
+
* adding spaces between lines when tags are stripped in [pagelist_ext];
|
99 |
|
100 |
= 2.4 =
|
101 |
+
* escaping attributes in title in [pagelist_ext];
|
102 |
|
103 |
= 2.3 =
|
104 |
+
* fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content;
|
105 |
|
106 |
= 2.2 =
|
107 |
+
* fixed offset parameter;
|
108 |
|
109 |
= 2.1 =
|
110 |
+
* fixed number parameter;
|
111 |
|
112 |
= 2.0 =
|
113 |
+
* fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature;
|
114 |
|
115 |
= 1.9 =
|
116 |
+
* added show_child_count parameter;
|
117 |
+
* added show_meta_key parameter;
|
118 |
|
119 |
= 1.8 =
|
120 |
+
* added screenshots;
|
121 |
+
* improved parameter parsing;
|
122 |
|
123 |
= 1.7 =
|
124 |
+
* added strip_tags parameter;
|
125 |
|
126 |
= 1.6 =
|
127 |
+
* improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters;
|
128 |
|
129 |
= 1.5 =
|
130 |
+
* added [pagelist_ext] shortcode - list of pages with featured image;
|
131 |
|
132 |
= 1.4 =
|
133 |
+
* added exclude="current" parameter;
|
134 |
|
135 |
= 1.3.0 =
|
136 |
+
* added class to ul elements by default;
|
137 |
+
* added "class" option (thanks to Arvind);
|
138 |
|
139 |
= 1.2.0 =
|
140 |
+
* added [subpages] and [siblings] shortcodes;
|
141 |
|
142 |
= 1.0.0 =
|
143 |
+
* initial release;
|
144 |
|
145 |
== Installation ==
|
146 |
|