Version Description
- Fix custom field values coming from parent post in certain contexts. Props @chrisneward for catching it!
- Add post-thumbnail display to output just the featured image of a post. Props @pereztroff for the feature request.
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.3.0 |
Comparing to | |
See all releases |
Code changes from version 3.2.9 to 3.3.0
- insert-pages.php +14 -6
- js/wpinsertpages.js +1 -1
- readme.txt +4 -0
- widget.php +1 -0
insert-pages.php
CHANGED
@@ -9,7 +9,7 @@ Author URI: http://www.linkedin.com/in/paulrryan
|
|
9 |
Text Domain: insert-pages
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
-
Version: 3.
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
@@ -29,7 +29,7 @@ Version: 3.2.9
|
|
29 |
*/
|
30 |
|
31 |
/* Shortcode Format:
|
32 |
-
[insert page='{slug}|{id}' display='title|link|excerpt|excerpt-only|content|all|{custom-template.php}' class='any-classes']
|
33 |
*/
|
34 |
|
35 |
// Define the InsertPagesPlugin class (variables and functions)
|
@@ -70,7 +70,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
70 |
'wpinsertpages',
|
71 |
plugins_url( '/js/wpinsertpages.js', __FILE__ ),
|
72 |
array( 'wpdialogs' ),
|
73 |
-
'
|
74 |
);
|
75 |
wp_localize_script(
|
76 |
'wpinsertpages',
|
@@ -193,7 +193,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
193 |
|
194 |
/**
|
195 |
* Filter the chosen display method, where display can be one of:
|
196 |
-
* title, link, excerpt, excerpt-only, content, all, {custom-template.php}
|
197 |
* Useful for admins who want to restrict the display sitewide.
|
198 |
*
|
199 |
* @since 3.2.7
|
@@ -356,6 +356,10 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
356 |
echo $content;
|
357 |
break;
|
358 |
|
|
|
|
|
|
|
|
|
359 |
case "all":
|
360 |
// Title.
|
361 |
$title_tag = $attributes['inline'] ? 'span' : 'h1';
|
@@ -377,7 +381,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
377 |
if ( is_protected_meta( $keyt, 'post' ) ) {
|
378 |
continue;
|
379 |
}
|
380 |
-
$value = get_post_custom_values( $key );
|
381 |
if ( is_array( $value ) ) {
|
382 |
$values = array_map( 'trim', $value );
|
383 |
$value = implode( $values, ', ' );
|
@@ -533,6 +537,9 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
533 |
the_post();
|
534 |
if ( $attributes['should_apply_the_content_filter'] ) the_content(); else echo get_the_content();
|
535 |
break;
|
|
|
|
|
|
|
536 |
case "all":
|
537 |
the_post();
|
538 |
$title_tag = $attributes['inline'] ? 'span' : 'h1';
|
@@ -742,6 +749,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
742 |
<option value='excerpt'><?php _e( 'Excerpt with title', 'insert-pages' ); ?></option>
|
743 |
<option value='excerpt-only'><?php _e( 'Excerpt only (no title)', 'insert-pages' ); ?></option>
|
744 |
<option value='content'><?php _e( 'Content', 'insert-pages' ); ?></option>
|
|
|
745 |
<option value='all'><?php _e( 'All (includes custom fields)', 'insert-pages' ); ?></option>
|
746 |
<option value='template'><?php _e( 'Use a custom template', 'insert-pages' ); ?> »</option>
|
747 |
</select>
|
@@ -902,7 +910,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
902 |
function insertPages_add_quicktags() {
|
903 |
if ( wp_script_is( 'quicktags' ) ) : ?>
|
904 |
<script type="text/javascript">
|
905 |
-
QTags.addButton( 'ed_insert_page', '[insert page]', "[insert page='your-page-slug' display='title|link|excerpt|excerpt-only|content|all']\n", '', '', 'Insert Page', 999 );
|
906 |
</script>
|
907 |
<?php endif;
|
908 |
}
|
9 |
Text Domain: insert-pages
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
+
Version: 3.3.0
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
29 |
*/
|
30 |
|
31 |
/* Shortcode Format:
|
32 |
+
[insert page='{slug}|{id}' display='title|link|excerpt|excerpt-only|content|post-thumbnail|all|{custom-template.php}' class='any-classes']
|
33 |
*/
|
34 |
|
35 |
// Define the InsertPagesPlugin class (variables and functions)
|
70 |
'wpinsertpages',
|
71 |
plugins_url( '/js/wpinsertpages.js', __FILE__ ),
|
72 |
array( 'wpdialogs' ),
|
73 |
+
'20180201'
|
74 |
);
|
75 |
wp_localize_script(
|
76 |
'wpinsertpages',
|
193 |
|
194 |
/**
|
195 |
* Filter the chosen display method, where display can be one of:
|
196 |
+
* title, link, excerpt, excerpt-only, content, post-thumbnail, all, {custom-template.php}
|
197 |
* Useful for admins who want to restrict the display sitewide.
|
198 |
*
|
199 |
* @since 3.2.7
|
356 |
echo $content;
|
357 |
break;
|
358 |
|
359 |
+
case "post-thumbnail":
|
360 |
+
?><a href="<?php echo esc_url( get_permalink( $inserted_page->ID ) ); ?>"><?php echo get_the_post_thumbnail( $inserted_page->ID ); ?></a><?php
|
361 |
+
break;
|
362 |
+
|
363 |
case "all":
|
364 |
// Title.
|
365 |
$title_tag = $attributes['inline'] ? 'span' : 'h1';
|
381 |
if ( is_protected_meta( $keyt, 'post' ) ) {
|
382 |
continue;
|
383 |
}
|
384 |
+
$value = get_post_custom_values( $key, $inserted_page->ID );
|
385 |
if ( is_array( $value ) ) {
|
386 |
$values = array_map( 'trim', $value );
|
387 |
$value = implode( $values, ', ' );
|
537 |
the_post();
|
538 |
if ( $attributes['should_apply_the_content_filter'] ) the_content(); else echo get_the_content();
|
539 |
break;
|
540 |
+
case "post-thumbnail":
|
541 |
+
?><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a><?php
|
542 |
+
break;
|
543 |
case "all":
|
544 |
the_post();
|
545 |
$title_tag = $attributes['inline'] ? 'span' : 'h1';
|
749 |
<option value='excerpt'><?php _e( 'Excerpt with title', 'insert-pages' ); ?></option>
|
750 |
<option value='excerpt-only'><?php _e( 'Excerpt only (no title)', 'insert-pages' ); ?></option>
|
751 |
<option value='content'><?php _e( 'Content', 'insert-pages' ); ?></option>
|
752 |
+
<option value='post-thumbnail'><?php _e( 'Post Thumbnail', 'insert-pages' ); ?></option>
|
753 |
<option value='all'><?php _e( 'All (includes custom fields)', 'insert-pages' ); ?></option>
|
754 |
<option value='template'><?php _e( 'Use a custom template', 'insert-pages' ); ?> »</option>
|
755 |
</select>
|
910 |
function insertPages_add_quicktags() {
|
911 |
if ( wp_script_is( 'quicktags' ) ) : ?>
|
912 |
<script type="text/javascript">
|
913 |
+
QTags.addButton( 'ed_insert_page', '[insert page]', "[insert page='your-page-slug' display='title|link|excerpt|excerpt-only|content|post-thumbnail|all']\n", '', '', 'Insert Page', 999 );
|
914 |
</script>
|
915 |
<?php endif;
|
916 |
}
|
js/wpinsertpages.js
CHANGED
@@ -222,7 +222,7 @@ var wpInsertPages;
|
|
222 |
regexp = /display=['"]([^['"]*)['"]/;
|
223 |
matches = regexp.exec( shortcode );
|
224 |
if ( matches && matches.length > 1 ) {
|
225 |
-
if ( ['title', 'link', 'excerpt', 'excerpt-only', 'content', 'all', ].indexOf( matches[1] ) >= 0 ) {
|
226 |
inputs.format.val( matches[1] );
|
227 |
inputs.template.val( 'all' );
|
228 |
} else {
|
222 |
regexp = /display=['"]([^['"]*)['"]/;
|
223 |
matches = regexp.exec( shortcode );
|
224 |
if ( matches && matches.length > 1 ) {
|
225 |
+
if ( ['title', 'link', 'excerpt', 'excerpt-only', 'content', 'post-thumbnail', 'all', ].indexOf( matches[1] ) >= 0 ) {
|
226 |
inputs.format.val( matches[1] );
|
227 |
inputs.template.val( 'all' );
|
228 |
} else {
|
readme.txt
CHANGED
@@ -86,6 +86,10 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
|
|
89 |
= 3.2.9 =
|
90 |
* Add querystring parameter to the shortcode to pass custom querystring values to any custom templates.
|
91 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 3.3.0 =
|
90 |
+
* Fix custom field values coming from parent post in certain contexts. Props @chrisneward for catching it!
|
91 |
+
* Add post-thumbnail display to output just the featured image of a post. Props @pereztroff for the feature request.
|
92 |
+
|
93 |
= 3.2.9 =
|
94 |
* Add querystring parameter to the shortcode to pass custom querystring values to any custom templates.
|
95 |
|
widget.php
CHANGED
@@ -93,6 +93,7 @@ class InsertPagesWidget extends WP_Widget {
|
|
93 |
<option value='excerpt' <?php selected( $instance['display'], 'excerpt' ); ?>><?php _e( 'Excerpt', 'insert-pages' ); ?></option>
|
94 |
<option value='excerpt-only' <?php selected( $instance['display'], 'excerpt-only' ); ?>><?php _e( 'Excerpt only (no title)', 'insert-pages' ); ?></option>
|
95 |
<option value='content' <?php selected( $instance['display'], 'content' ); ?>><?php _e( 'Content', 'insert-pages' ); ?></option>
|
|
|
96 |
<option value='all' <?php selected( $instance['display'], 'all' ); ?>><?php _e( 'All (includes custom fields)', 'insert-pages' ); ?></option>
|
97 |
<option value='template' <?php selected( $instance['display'], 'template' ); ?>><?php _e( 'Use a custom template', 'insert-pages' ); ?> »</option>
|
98 |
</select>
|
93 |
<option value='excerpt' <?php selected( $instance['display'], 'excerpt' ); ?>><?php _e( 'Excerpt', 'insert-pages' ); ?></option>
|
94 |
<option value='excerpt-only' <?php selected( $instance['display'], 'excerpt-only' ); ?>><?php _e( 'Excerpt only (no title)', 'insert-pages' ); ?></option>
|
95 |
<option value='content' <?php selected( $instance['display'], 'content' ); ?>><?php _e( 'Content', 'insert-pages' ); ?></option>
|
96 |
+
<option value='post-thumbnail' <?php selected( $instance['display'], 'post-thumbnail' ); ?>><?php _e( 'Post Thumbnail', 'insert-pages' ); ?></option>
|
97 |
<option value='all' <?php selected( $instance['display'], 'all' ); ?>><?php _e( 'All (includes custom fields)', 'insert-pages' ); ?></option>
|
98 |
<option value='template' <?php selected( $instance['display'], 'template' ); ?>><?php _e( 'Use a custom template', 'insert-pages' ); ?> »</option>
|
99 |
</select>
|