Version Description
- 2012.10.30 =
- remove conflict between Pagelist and Sitemap plugins
- remove preg_match_all notice
- minor changes
Download this release
Release Info
Developer | webvitaly |
Plugin | Sitemap |
Version | 4.0 |
Comparing to | |
See all releases |
Code changes from version 3.8 to 4.0
- css/page-list.css +9 -6
- readme.txt +23 -16
- sitemap.php +81 -60
css/page-list.css
CHANGED
@@ -1,4 +1,12 @@
|
|
1 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/* default styles for [pagelist_ext] */
|
4 |
.page-list-ext .page-list-ext-item {
|
@@ -13,8 +21,3 @@
|
|
13 |
.page-list-ext .page-list-ext-title {
|
14 |
clear: none;
|
15 |
}
|
16 |
-
|
17 |
-
/* default styles for [pagelist], [subpages], [siblings] */
|
18 |
-
.page-list .current_page_item a {
|
19 |
-
font-weight: bold; /* hilite active item */
|
20 |
-
}
|
1 |
+
/*
|
2 |
+
Page-list plugin
|
3 |
+
http://wordpress.org/extend/plugins/page-list/
|
4 |
+
*/
|
5 |
+
|
6 |
+
/* default styles for [pagelist], [subpages], [siblings] */
|
7 |
+
.page-list .current_page_item > a {
|
8 |
+
font-weight: bold; /* hilite active item */
|
9 |
+
}
|
10 |
|
11 |
/* default styles for [pagelist_ext] */
|
12 |
.page-list-ext .page-list-ext-item {
|
21 |
.page-list-ext .page-list-ext-title {
|
22 |
clear: none;
|
23 |
}
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
=== Sitemap ===
|
2 |
Contributors: webvitaly
|
3 |
-
|
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.
|
8 |
-
Stable tag:
|
|
|
|
|
9 |
|
10 |
[pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
11 |
|
@@ -13,25 +14,26 @@ Stable tag: 3.8
|
|
13 |
|
14 |
**Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/)** Please, delete Sitemap plugin and install [Pagelist plugin](http://wordpress.org/extend/plugins/page-list/). Don't be afraid, the functionality of these plugins is the same.
|
15 |
|
|
|
16 |
= shortcodes: =
|
17 |
|
18 |
* **[pagelist]** - hierarchical tree of all pages on site (useful to show sitemap of the site);
|
19 |
* **[subpages]** - hierarchical tree of subpages to the current page;
|
20 |
* **[siblings]** - hierarchical tree of sibling pages to the current page;
|
21 |
-
* **[pagelist_ext]** - list of pages with featured image and with excerpt
|
22 |
|
23 |
= aditional parameters examples: =
|
24 |
|
25 |
* `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
|
26 |
* `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
|
27 |
-
* [all Page-list params](http://wordpress.org/extend/plugins/
|
28 |
|
29 |
-
[Page-list
|
30 |
|
31 |
-
=
|
32 |
-
* ["Iframe" - embed iframe with shortcode](http://wordpress.org/extend/plugins/iframe/)
|
33 |
-
* ["
|
34 |
-
* ["Filenames to latin" - sanitize filenames to latin during upload](http://wordpress.org/extend/plugins/filenames-to-latin/)
|
35 |
|
36 |
== Other Notes ==
|
37 |
|
@@ -107,13 +109,13 @@ Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The
|
|
107 |
To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/plugins/google-sitemap-generator/) plugin.
|
108 |
|
109 |
= Is there "more-link" feature in the plugin? =
|
110 |
-
No, there is no "more-link" feature in the plugin. Because "more-link":
|
111 |
|
112 |
-
* **
|
113 |
-
* **
|
114 |
|
115 |
-
|
116 |
-
|
117 |
|
118 |
== Screenshots ==
|
119 |
|
@@ -122,6 +124,11 @@ But if you still need "more-link" feature and you will add it by yourself, than
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
= 3.8 =
|
126 |
* fixed default [pagelist_ext] behaviour - showing all pages if there is no subpages
|
127 |
|
1 |
=== Sitemap ===
|
2 |
Contributors: webvitaly
|
3 |
+
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: 3.5
|
7 |
+
Stable tag: 4.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
[pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
12 |
|
14 |
|
15 |
**Code moved to [page-list plugin](http://wordpress.org/extend/plugins/page-list/)** Please, delete Sitemap plugin and install [Pagelist plugin](http://wordpress.org/extend/plugins/page-list/). Don't be afraid, the functionality of these plugins is the same.
|
16 |
|
17 |
+
|
18 |
= shortcodes: =
|
19 |
|
20 |
* **[pagelist]** - hierarchical tree of all pages on site (useful to show sitemap of the site);
|
21 |
* **[subpages]** - hierarchical tree of subpages to the current page;
|
22 |
* **[siblings]** - hierarchical tree of sibling pages to the current page;
|
23 |
+
* **[pagelist_ext]** - list of pages with featured image and with excerpt;
|
24 |
|
25 |
= aditional parameters examples: =
|
26 |
|
27 |
* `[pagelist depth="2" child_of="4" exclude="6,7,8"]`
|
28 |
* `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
|
29 |
+
* **[all Page-list params](http://wordpress.org/extend/plugins/page-list/other_notes/)**
|
30 |
|
31 |
+
**[Page-list support page](http://web-profile.com.ua/wordpress/plugins/page-list/)**
|
32 |
|
33 |
+
= Useful plugins: =
|
34 |
+
* ["Iframe" - embed iframe with shortcode](http://wordpress.org/extend/plugins/iframe/ "embed iframe")
|
35 |
+
* ["Anti-spam" - block spam in comments](http://wordpress.org/extend/plugins/anti-spam/ "no spam, no captcha")
|
36 |
+
* ["Filenames to latin" - sanitize filenames to latin during upload](http://wordpress.org/extend/plugins/filenames-to-latin/ "sanitize filenames to latin")
|
37 |
|
38 |
== Other Notes ==
|
39 |
|
109 |
To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/extend/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.
|
116 |
|
117 |
+
= What to do if you need to change the plugin's code? =
|
118 |
+
When you changed the plugin's code you should also change the plugin's version to '100' to avoid updates, which could override and delete your code.
|
119 |
|
120 |
== Screenshots ==
|
121 |
|
124 |
|
125 |
== Changelog ==
|
126 |
|
127 |
+
= 4.0 - 2012.10.30 =
|
128 |
+
* remove conflict between Pagelist and Sitemap plugins
|
129 |
+
* remove preg_match_all notice
|
130 |
+
* minor changes
|
131 |
+
|
132 |
= 3.8 =
|
133 |
* fixed default [pagelist_ext] behaviour - showing all pages if there is no subpages
|
134 |
|
sitemap.php
CHANGED
@@ -1,24 +1,28 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Sitemap
|
4 |
-
Plugin URI: http://
|
5 |
Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
6 |
-
Version:
|
7 |
Author: webvitaly
|
8 |
-
Author
|
9 |
-
|
10 |
*/
|
11 |
|
12 |
-
|
13 |
-
function
|
14 |
-
|
|
|
|
|
15 |
}
|
16 |
|
17 |
-
$pagelist_powered_line = "\n".'<!-- Page-list plugin v.3.8 [ wordpress.org/extend/plugins/page-list/ ] -->'."\n";
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
$return = '';
|
23 |
extract( shortcode_atts( array(
|
24 |
'depth' => '0',
|
@@ -41,8 +45,8 @@ if ( !function_exists('pagelist_shortcode') ) {
|
|
41 |
|
42 |
$page_list_args = array(
|
43 |
'depth' => $depth,
|
44 |
-
'child_of' =>
|
45 |
-
'exclude' =>
|
46 |
'exclude_tree' => $exclude_tree,
|
47 |
'include' => $include,
|
48 |
'title_li' => $title_li,
|
@@ -62,23 +66,24 @@ if ( !function_exists('pagelist_shortcode') ) {
|
|
62 |
);
|
63 |
$list_pages = wp_list_pages( $page_list_args );
|
64 |
|
|
|
65 |
if ($list_pages) {
|
66 |
-
$return = $pagelist_powered_line;
|
67 |
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
68 |
}else{
|
69 |
-
$return
|
70 |
}
|
71 |
return $return;
|
72 |
}
|
73 |
-
add_shortcode( 'pagelist', '
|
74 |
-
add_shortcode( 'page_list', '
|
75 |
-
add_shortcode( 'page-list', '
|
76 |
-
add_shortcode( 'sitemap', '
|
77 |
}
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
82 |
$return = '';
|
83 |
extract( shortcode_atts( array(
|
84 |
'depth' => '0',
|
@@ -102,7 +107,7 @@ if ( !function_exists('subpages_shortcode') ) {
|
|
102 |
$page_list_args = array(
|
103 |
'depth' => $depth,
|
104 |
'child_of' => $post->ID,
|
105 |
-
'exclude' =>
|
106 |
'exclude_tree' => $exclude_tree,
|
107 |
'include' => $include,
|
108 |
'title_li' => $title_li,
|
@@ -122,23 +127,24 @@ if ( !function_exists('subpages_shortcode') ) {
|
|
122 |
);
|
123 |
$list_pages = wp_list_pages( $page_list_args );
|
124 |
|
|
|
125 |
if ($list_pages) {
|
126 |
-
$return = $pagelist_powered_line;
|
127 |
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
128 |
}else{
|
129 |
-
$return
|
130 |
}
|
131 |
return $return;
|
132 |
}
|
133 |
-
add_shortcode( 'subpages', '
|
134 |
-
add_shortcode( 'sub_pages', '
|
135 |
-
add_shortcode( 'sub-pages', '
|
136 |
-
add_shortcode( 'children', '
|
137 |
}
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
142 |
$return = '';
|
143 |
extract( shortcode_atts( array(
|
144 |
'depth' => '0',
|
@@ -166,7 +172,7 @@ if ( !function_exists('siblings_shortcode') ) {
|
|
166 |
$page_list_args = array(
|
167 |
'depth' => $depth,
|
168 |
'child_of' => $post->post_parent,
|
169 |
-
'exclude' =>
|
170 |
'exclude_tree' => $exclude_tree,
|
171 |
'include' => $include,
|
172 |
'title_li' => $title_li,
|
@@ -186,20 +192,21 @@ if ( !function_exists('siblings_shortcode') ) {
|
|
186 |
);
|
187 |
$list_pages = wp_list_pages( $page_list_args );
|
188 |
|
|
|
189 |
if ($list_pages) {
|
190 |
-
$return = $pagelist_powered_line;
|
191 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
192 |
}else{
|
193 |
-
$return
|
194 |
}
|
195 |
return $return;
|
196 |
}
|
197 |
-
add_shortcode( 'siblings', '
|
198 |
}
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
203 |
$return = '';
|
204 |
extract( shortcode_atts( array(
|
205 |
'show_image' => 1,
|
@@ -247,16 +254,16 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
247 |
'limit_content' => $limit_content,
|
248 |
'image_width' => $image_width,
|
249 |
'image_height' => $image_height,
|
250 |
-
'child_of' =>
|
251 |
'sort_order' => $sort_order,
|
252 |
'sort_column' => $sort_column,
|
253 |
'hierarchical' => $hierarchical,
|
254 |
-
'exclude' =>
|
255 |
'include' => $include,
|
256 |
'meta_key' => $meta_key,
|
257 |
'meta_value' => $meta_value,
|
258 |
'authors' => $authors,
|
259 |
-
'parent' =>
|
260 |
'exclude_tree' => $exclude_tree,
|
261 |
'number' => '', // $number - own counter
|
262 |
'offset' => 0, // $offset - own offset
|
@@ -283,12 +290,12 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
283 |
'sort_order' => $sort_order,
|
284 |
'sort_column' => $sort_column,
|
285 |
'hierarchical' => $hierarchical,
|
286 |
-
'exclude' =>
|
287 |
'include' => $include,
|
288 |
'meta_key' => $meta_key,
|
289 |
'meta_value' => $meta_value,
|
290 |
'authors' => $authors,
|
291 |
-
'parent' =>
|
292 |
'exclude_tree' => $exclude_tree,
|
293 |
'number' => '', // $number - own counter
|
294 |
'offset' => 0, // $offset - own offset
|
@@ -327,7 +334,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
327 |
$list_pages_html .= '</a></div> ';
|
328 |
}else{
|
329 |
if( $show_first_image == 1 ){
|
330 |
-
$img_scr =
|
331 |
if( !empty( $img_scr ) ){
|
332 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
333 |
$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
|
@@ -337,7 +344,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
337 |
}
|
338 |
}else{
|
339 |
if( $show_first_image == 1 ){
|
340 |
-
$img_scr =
|
341 |
if( !empty( $img_scr ) ){
|
342 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
343 |
$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
|
@@ -364,7 +371,7 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
364 |
if ( post_password_required($page) ) {
|
365 |
$content = '<!-- password protected -->';
|
366 |
}else{
|
367 |
-
$content =
|
368 |
$content = do_shortcode( $content );
|
369 |
|
370 |
if( $show_title == 0 ){ // make content as a link if there is no title
|
@@ -405,19 +412,21 @@ if ( !function_exists('pagelist_ext_shortcode') ) {
|
|
405 |
}
|
406 |
}
|
407 |
}
|
|
|
408 |
if ($list_pages_html) {
|
409 |
-
$return = $pagelist_powered_line;
|
410 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
411 |
}else{
|
412 |
-
$return
|
413 |
}
|
414 |
return $return;
|
415 |
}
|
416 |
-
add_shortcode( 'pagelist_ext', '
|
|
|
417 |
}
|
418 |
|
419 |
-
|
420 |
-
|
|
|
421 |
global $post;
|
422 |
$new_str = $str;
|
423 |
$new_str = str_replace('this', $post->ID, $new_str); // exclude this page
|
@@ -428,8 +437,9 @@ if ( !function_exists('pagelist_norm_params') ) {
|
|
428 |
}
|
429 |
}
|
430 |
|
431 |
-
|
432 |
-
|
|
|
433 |
|
434 |
$more_tag_found = 0;
|
435 |
$content_before_more_tag_length = 0;
|
@@ -486,16 +496,27 @@ if ( !function_exists('page_list_parse_content') ) {
|
|
486 |
}
|
487 |
}
|
488 |
|
489 |
-
|
490 |
-
|
|
|
491 |
$first_img = '';
|
492 |
//ob_start();
|
493 |
//ob_end_clean();
|
494 |
-
$
|
495 |
-
$
|
496 |
-
|
497 |
-
$first_img = '';
|
498 |
}
|
499 |
return $first_img;
|
500 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Sitemap
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/page-list/
|
5 |
Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
6 |
+
Version: 4.0
|
7 |
Author: webvitaly
|
8 |
+
Author URI: http://profiles.wordpress.org/webvitaly/
|
9 |
+
License: GPLv2 or later
|
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, '4.0', 'all' );
|
15 |
+
}
|
16 |
+
add_action('wp_print_styles', 'pagelist_unqprfx_add_stylesheet');
|
17 |
}
|
18 |
|
|
|
19 |
|
20 |
+
$pagelist_unqprfx_powered_line = "\n".'<!-- Page-list plugin v.4.0 wordpress.org/extend/plugins/page-list/ -->'."\n";
|
21 |
+
|
22 |
+
|
23 |
+
if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
24 |
+
function pagelist_unqprfx_shortcode( $atts ) {
|
25 |
+
global $post, $pagelist_unqprfx_powered_line;
|
26 |
$return = '';
|
27 |
extract( shortcode_atts( array(
|
28 |
'depth' => '0',
|
45 |
|
46 |
$page_list_args = array(
|
47 |
'depth' => $depth,
|
48 |
+
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
49 |
+
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
50 |
'exclude_tree' => $exclude_tree,
|
51 |
'include' => $include,
|
52 |
'title_li' => $title_li,
|
66 |
);
|
67 |
$list_pages = wp_list_pages( $page_list_args );
|
68 |
|
69 |
+
$return = $pagelist_unqprfx_powered_line;
|
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;
|
76 |
}
|
77 |
+
add_shortcode( 'pagelist', 'pagelist_unqprfx_shortcode' );
|
78 |
+
add_shortcode( 'page_list', 'pagelist_unqprfx_shortcode' );
|
79 |
+
add_shortcode( 'page-list', 'pagelist_unqprfx_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
|
80 |
+
add_shortcode( 'sitemap', 'pagelist_unqprfx_shortcode' );
|
81 |
}
|
82 |
|
83 |
+
|
84 |
+
if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
85 |
+
function subpages_unqprfx_shortcode( $atts ) {
|
86 |
+
global $post, $pagelist_unqprfx_powered_line;
|
87 |
$return = '';
|
88 |
extract( shortcode_atts( array(
|
89 |
'depth' => '0',
|
107 |
$page_list_args = array(
|
108 |
'depth' => $depth,
|
109 |
'child_of' => $post->ID,
|
110 |
+
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
111 |
'exclude_tree' => $exclude_tree,
|
112 |
'include' => $include,
|
113 |
'title_li' => $title_li,
|
127 |
);
|
128 |
$list_pages = wp_list_pages( $page_list_args );
|
129 |
|
130 |
+
$return = $pagelist_unqprfx_powered_line;
|
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;
|
137 |
}
|
138 |
+
add_shortcode( 'subpages', 'subpages_unqprfx_shortcode' );
|
139 |
+
add_shortcode( 'sub_pages', 'subpages_unqprfx_shortcode' );
|
140 |
+
add_shortcode( 'sub-pages', 'subpages_unqprfx_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
|
141 |
+
add_shortcode( 'children', 'subpages_unqprfx_shortcode' );
|
142 |
}
|
143 |
|
144 |
+
|
145 |
+
if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
146 |
+
function siblings_unqprfx_shortcode( $atts ) {
|
147 |
+
global $post, $pagelist_unqprfx_powered_line;
|
148 |
$return = '';
|
149 |
extract( shortcode_atts( array(
|
150 |
'depth' => '0',
|
172 |
$page_list_args = array(
|
173 |
'depth' => $depth,
|
174 |
'child_of' => $post->post_parent,
|
175 |
+
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
176 |
'exclude_tree' => $exclude_tree,
|
177 |
'include' => $include,
|
178 |
'title_li' => $title_li,
|
192 |
);
|
193 |
$list_pages = wp_list_pages( $page_list_args );
|
194 |
|
195 |
+
$return = $pagelist_unqprfx_powered_line;
|
196 |
if ($list_pages) {
|
|
|
197 |
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
198 |
}else{
|
199 |
+
$return .= '<!-- no pages to show -->';
|
200 |
}
|
201 |
return $return;
|
202 |
}
|
203 |
+
add_shortcode( 'siblings', 'siblings_unqprfx_shortcode' );
|
204 |
}
|
205 |
|
206 |
+
|
207 |
+
if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
208 |
+
function pagelist_unqprfx_ext_shortcode( $atts ) {
|
209 |
+
global $post, $pagelist_unqprfx_powered_line;
|
210 |
$return = '';
|
211 |
extract( shortcode_atts( array(
|
212 |
'show_image' => 1,
|
254 |
'limit_content' => $limit_content,
|
255 |
'image_width' => $image_width,
|
256 |
'image_height' => $image_height,
|
257 |
+
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
258 |
'sort_order' => $sort_order,
|
259 |
'sort_column' => $sort_column,
|
260 |
'hierarchical' => $hierarchical,
|
261 |
+
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
262 |
'include' => $include,
|
263 |
'meta_key' => $meta_key,
|
264 |
'meta_value' => $meta_value,
|
265 |
'authors' => $authors,
|
266 |
+
'parent' => pagelist_unqprfx_norm_params($parent),
|
267 |
'exclude_tree' => $exclude_tree,
|
268 |
'number' => '', // $number - own counter
|
269 |
'offset' => 0, // $offset - own offset
|
290 |
'sort_order' => $sort_order,
|
291 |
'sort_column' => $sort_column,
|
292 |
'hierarchical' => $hierarchical,
|
293 |
+
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
294 |
'include' => $include,
|
295 |
'meta_key' => $meta_key,
|
296 |
'meta_value' => $meta_value,
|
297 |
'authors' => $authors,
|
298 |
+
'parent' => pagelist_unqprfx_norm_params($parent),
|
299 |
'exclude_tree' => $exclude_tree,
|
300 |
'number' => '', // $number - own counter
|
301 |
'offset' => 0, // $offset - own offset
|
334 |
$list_pages_html .= '</a></div> ';
|
335 |
}else{
|
336 |
if( $show_first_image == 1 ){
|
337 |
+
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
338 |
if( !empty( $img_scr ) ){
|
339 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
340 |
$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
|
344 |
}
|
345 |
}else{
|
346 |
if( $show_first_image == 1 ){
|
347 |
+
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
348 |
if( !empty( $img_scr ) ){
|
349 |
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
350 |
$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
|
371 |
if ( post_password_required($page) ) {
|
372 |
$content = '<!-- password protected -->';
|
373 |
}else{
|
374 |
+
$content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
|
375 |
$content = do_shortcode( $content );
|
376 |
|
377 |
if( $show_title == 0 ){ // make content as a link if there is no title
|
412 |
}
|
413 |
}
|
414 |
}
|
415 |
+
$return = $pagelist_unqprfx_powered_line;
|
416 |
if ($list_pages_html) {
|
|
|
417 |
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
418 |
}else{
|
419 |
+
$return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
|
420 |
}
|
421 |
return $return;
|
422 |
}
|
423 |
+
add_shortcode( 'pagelist_ext', 'pagelist_unqprfx_ext_shortcode' );
|
424 |
+
add_shortcode( 'pagelistext', 'pagelist_unqprfx_ext_shortcode' );
|
425 |
}
|
426 |
|
427 |
+
|
428 |
+
if ( !function_exists('pagelist_unqprfx_norm_params') ) {
|
429 |
+
function pagelist_unqprfx_norm_params( $str ) {
|
430 |
global $post;
|
431 |
$new_str = $str;
|
432 |
$new_str = str_replace('this', $post->ID, $new_str); // exclude this page
|
437 |
}
|
438 |
}
|
439 |
|
440 |
+
|
441 |
+
if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
442 |
+
function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
|
443 |
|
444 |
$more_tag_found = 0;
|
445 |
$content_before_more_tag_length = 0;
|
496 |
}
|
497 |
}
|
498 |
|
499 |
+
|
500 |
+
if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
|
501 |
+
function pagelist_unqprfx_get_first_image( $content='' ) {
|
502 |
$first_img = '';
|
503 |
//ob_start();
|
504 |
//ob_end_clean();
|
505 |
+
$matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
506 |
+
if ( $matchCount !== 0 ) { // if we found first image
|
507 |
+
$first_img = $matches[1][0];
|
|
|
508 |
}
|
509 |
return $first_img;
|
510 |
}
|
511 |
+
}
|
512 |
+
|
513 |
+
if ( !function_exists('pagelist_unqprfx_plugin_meta') ) {
|
514 |
+
function pagelist_unqprfx_plugin_meta( $links, $file ) { // add 'Support' and 'Donate' links to plugin meta row
|
515 |
+
if ( strpos( $file, 'sitemap.php' ) !== false ) {
|
516 |
+
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/page-list/" title="Need help?">' . __('Support') . '</a>' ) );
|
517 |
+
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">' . __('Donate') . '</a>' ) );
|
518 |
+
}
|
519 |
+
return $links;
|
520 |
+
}
|
521 |
+
add_filter( 'plugin_row_meta', 'pagelist_unqprfx_plugin_meta', 10, 2 );
|
522 |
}
|