Insert Pages - Version 3.0.2

Version Description

  • Hotfix: Inserting posts with custom paths using legacy insert method.
Download this release

Release Info

Developer figureone
Plugin Icon wp plugin Insert Pages
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

Files changed (2) hide show
  1. insert-pages.php +45 -25
  2. readme.txt +3 -0
insert-pages.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: Insert Pages
5
  Plugin URI: https://github.com/uhm-coe/insert-pages
6
  Description: Insert Pages lets you embed any WordPress content (e.g., pages, posts, custom post types) into other WordPress content using the Shortcode API.
7
  Author: Paul Ryan
8
- Version: 3.0.1
9
  Author URI: http://www.linkedin.com/in/paulrryan
10
  License: GPL2
11
  */
@@ -188,34 +188,35 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
188
  $inserted_page = get_post( intval( $attributes['page'] ) );
189
  }
190
 
191
- // If we couldn't retrieve the page, fire the filter hook showing a not-found message.
192
- if ( $inserted_page === null ) {
193
- /**
194
- * Filter the html that should be displayed if an inserted page was not found.
195
- *
196
- * @param string $content html to be displayed. Defaults to an empty string.
197
- */
198
- $content = apply_filters( 'insert_pages_not_found_message', $content );
199
-
200
- // Short-circuit since we didn't find the page.
201
- return $content;
202
- }
203
-
204
- // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
205
- // Note: Temporarily set the global $post->ID to the inserted page ID,
206
- // since Beaver Builder relies on it to load the appropriate styles.
207
- if ( class_exists( 'FLBuilder' ) ) {
208
- $old_post_id = $post->ID;
209
- $post->ID = $inserted_page->ID;
210
- FLBuilder::enqueue_layout_styles_scripts( $inserted_page->ID );
211
- $post->ID = $old_post_id;
212
- }
213
-
214
  // Use "Normal" insert method (get_post()).
215
  if ( $options['wpip_insert_method'] !== 'legacy' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  // Start output buffering so we can save the output to a string.
217
  ob_start();
218
 
 
 
 
 
 
 
 
 
 
 
219
  // Show either the title, link, content, everything, or everything via a custom template
220
  // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
221
  // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
@@ -328,6 +329,8 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
328
 
329
  // Use "Legacy" insert method (query_posts()).
330
  } else {
 
 
331
  if ( is_numeric( $attributes['page'] ) ) {
332
  $args = array(
333
  'p' => intval( $attributes['page'] ),
@@ -343,6 +346,17 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
343
  if ( have_posts() ) {
344
  // Start output buffering so we can save the output to string
345
  ob_start();
 
 
 
 
 
 
 
 
 
 
 
346
  // Show either the title, link, content, everything, or everything via a custom template
347
  // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
348
  // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
@@ -394,7 +408,13 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
394
  }
395
  // Save output buffer contents.
396
  $content = ob_get_clean();
397
-
 
 
 
 
 
 
398
  }
399
  wp_reset_query();
400
  }
5
  Plugin URI: https://github.com/uhm-coe/insert-pages
6
  Description: Insert Pages lets you embed any WordPress content (e.g., pages, posts, custom post types) into other WordPress content using the Shortcode API.
7
  Author: Paul Ryan
8
+ Version: 3.0.2
9
  Author URI: http://www.linkedin.com/in/paulrryan
10
  License: GPL2
11
  */
188
  $inserted_page = get_post( intval( $attributes['page'] ) );
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  // Use "Normal" insert method (get_post()).
192
  if ( $options['wpip_insert_method'] !== 'legacy' ) {
193
+
194
+ // If we couldn't retrieve the page, fire the filter hook showing a not-found message.
195
+ if ( $inserted_page === null ) {
196
+ /**
197
+ * Filter the html that should be displayed if an inserted page was not found.
198
+ *
199
+ * @param string $content html to be displayed. Defaults to an empty string.
200
+ */
201
+ $content = apply_filters( 'insert_pages_not_found_message', $content );
202
+
203
+ // Short-circuit since we didn't find the page.
204
+ return $content;
205
+ }
206
+
207
  // Start output buffering so we can save the output to a string.
208
  ob_start();
209
 
210
+ // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
211
+ // Note: Temporarily set the global $post->ID to the inserted page ID,
212
+ // since Beaver Builder relies on it to load the appropriate styles.
213
+ if ( class_exists( 'FLBuilder' ) ) {
214
+ $old_post_id = $post->ID;
215
+ $post->ID = $inserted_page->ID;
216
+ FLBuilder::enqueue_layout_styles_scripts( $inserted_page->ID );
217
+ $post->ID = $old_post_id;
218
+ }
219
+
220
  // Show either the title, link, content, everything, or everything via a custom template
221
  // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
222
  // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
329
 
330
  // Use "Legacy" insert method (query_posts()).
331
  } else {
332
+
333
+ // Construct query_posts arguments.
334
  if ( is_numeric( $attributes['page'] ) ) {
335
  $args = array(
336
  'p' => intval( $attributes['page'] ),
346
  if ( have_posts() ) {
347
  // Start output buffering so we can save the output to string
348
  ob_start();
349
+
350
+ // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
351
+ // Note: Temporarily set the global $post->ID to the inserted page ID,
352
+ // since Beaver Builder relies on it to load the appropriate styles.
353
+ if ( class_exists( 'FLBuilder' ) ) {
354
+ $old_post_id = $post->ID;
355
+ $post->ID = $inserted_page->ID;
356
+ FLBuilder::enqueue_layout_styles_scripts( $inserted_page->ID );
357
+ $post->ID = $old_post_id;
358
+ }
359
+
360
  // Show either the title, link, content, everything, or everything via a custom template
361
  // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
362
  // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
408
  }
409
  // Save output buffer contents.
410
  $content = ob_get_clean();
411
+ } else {
412
+ /**
413
+ * Filter the html that should be displayed if an inserted page was not found.
414
+ *
415
+ * @param string $content html to be displayed. Defaults to an empty string.
416
+ */
417
+ $content = apply_filters( 'insert_pages_not_found_message', $content );
418
  }
419
  wp_reset_query();
420
  }
readme.txt CHANGED
@@ -86,6 +86,9 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 3.0.1 =
90
  * Hotfix: Version 3 broke some plugin compatibility (most notably with Beaver Builder and Page Builder by SiteOrigin). This update should restore functionality.
91
  * Hotfix: Version 3 broke some page displays (e.g., content, all). This update should restore functionality.
86
 
87
  == Changelog ==
88
 
89
+ = 3.0.2 =
90
+ * Hotfix: Inserting posts with custom paths using legacy insert method.
91
+
92
  = 3.0.1 =
93
  * Hotfix: Version 3 broke some plugin compatibility (most notably with Beaver Builder and Page Builder by SiteOrigin). This update should restore functionality.
94
  * Hotfix: Version 3 broke some page displays (e.g., content, all). This update should restore functionality.