Insert Pages - Version 3.2.8

Version Description

  • Add support for inserting pages/posts built with Elementor.
Download this release

Release Info

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

Code changes from version 3.2.7 to 3.2.8

Files changed (2) hide show
  1. insert-pages.php +27 -5
  2. readme.txt +4 -1
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.2.7
13
  */
14
 
15
  /* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
@@ -250,10 +250,11 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
250
  // Start output buffering so we can save the output to a string.
251
  ob_start();
252
 
253
- // If Beaver Builder or SiteOrigin Page Builder are enabled, load any cached styles associated with the inserted page.
 
254
  // Note: Temporarily set the global $post->ID to the inserted page ID,
255
  // since both builders rely on the id to load the appropriate styles.
256
- if ( class_exists( 'FLBuilder' ) || class_exists( 'SiteOrigin_Panels' ) ) {
257
  // If we're not in The Loop (i.e., global $post isn't assigned),
258
  // temporarily populate it with the post to be inserted so we can
259
  // retrieve generated styles for that post. Reset $post to null
@@ -275,6 +276,11 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
275
  $renderer->add_inline_css( $inserted_page->ID, $renderer->generate_css( $inserted_page->ID ) );
276
  }
277
 
 
 
 
 
 
278
  if ( is_null( $old_post_id ) ) {
279
  $post = null;
280
  } else {
@@ -310,6 +316,16 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
310
  break;
311
 
312
  case "content":
 
 
 
 
 
 
 
 
 
 
313
  $content = get_post_field( 'post_content', $inserted_page->ID );
314
  if ( $attributes['should_apply_the_content_filter'] ) {
315
  $content = apply_filters( 'the_content', $content );
@@ -426,10 +442,11 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
426
  // Start output buffering so we can save the output to string
427
  ob_start();
428
 
429
- // If Beaver Builder or SiteOrigin Page Builder are enabled, load any cached styles associated with the inserted page.
 
430
  // Note: Temporarily set the global $post->ID to the inserted page ID,
431
  // since both builders rely on the id to load the appropriate styles.
432
- if ( class_exists( 'FLBuilder' ) || class_exists( 'SiteOrigin_Panels' ) ) {
433
  // If we're not in The Loop (i.e., global $post isn't assigned),
434
  // temporarily populate it with the post to be inserted so we can
435
  // retrieve generated styles for that post. Reset $post to null
@@ -451,6 +468,11 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
451
  $renderer->add_inline_css( $inserted_page->ID, $renderer->generate_css( $inserted_page->ID ) );
452
  }
453
 
 
 
 
 
 
454
  if ( is_null( $old_post_id ) ) {
455
  $post = null;
456
  } else {
9
  Text Domain: insert-pages
10
  Domain Path: /languages
11
  License: GPL2
12
+ Version: 3.2.8
13
  */
14
 
15
  /* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
250
  // Start output buffering so we can save the output to a string.
251
  ob_start();
252
 
253
+ // If Beaver Builder, SiteOrigin Page Builder, or Elementor are enabled,
254
+ // load any cached styles associated with the inserted page.
255
  // Note: Temporarily set the global $post->ID to the inserted page ID,
256
  // since both builders rely on the id to load the appropriate styles.
257
+ if ( class_exists( 'FLBuilder' ) || class_exists( 'SiteOrigin_Panels' ) || class_exists( '\Elementor\Post_CSS_File' ) ) {
258
  // If we're not in The Loop (i.e., global $post isn't assigned),
259
  // temporarily populate it with the post to be inserted so we can
260
  // retrieve generated styles for that post. Reset $post to null
276
  $renderer->add_inline_css( $inserted_page->ID, $renderer->generate_css( $inserted_page->ID ) );
277
  }
278
 
279
+ if ( class_exists( '\Elementor\Post_CSS_File' ) ) {
280
+ $css_file = new \Elementor\Post_CSS_File( $inserted_page->ID );
281
+ $css_file->enqueue();
282
+ }
283
+
284
  if ( is_null( $old_post_id ) ) {
285
  $post = null;
286
  } else {
316
  break;
317
 
318
  case "content":
319
+ // If Elementor is installed, try to render the page with it. If there is no Elementor content, fall back to normal rendering.
320
+ if ( class_exists( '\Elementor\Plugin' ) ) {
321
+ $elementor_content = \Elementor\Plugin::$instance->frontend->get_builder_content( $inserted_page->ID );
322
+ if ( strlen( $elementor_content ) > 0 ) {
323
+ echo $elementor_content;
324
+ break;
325
+ }
326
+ }
327
+
328
+ // Render the content normally.
329
  $content = get_post_field( 'post_content', $inserted_page->ID );
330
  if ( $attributes['should_apply_the_content_filter'] ) {
331
  $content = apply_filters( 'the_content', $content );
442
  // Start output buffering so we can save the output to string
443
  ob_start();
444
 
445
+ // If Beaver Builder, SiteOrigin Page Builder, or Elementor are enabled,
446
+ // load any cached styles associated with the inserted page.
447
  // Note: Temporarily set the global $post->ID to the inserted page ID,
448
  // since both builders rely on the id to load the appropriate styles.
449
+ if ( class_exists( 'FLBuilder' ) || class_exists( 'SiteOrigin_Panels' ) || class_exists( '\Elementor\Post_CSS_File' ) ) {
450
  // If we're not in The Loop (i.e., global $post isn't assigned),
451
  // temporarily populate it with the post to be inserted so we can
452
  // retrieve generated styles for that post. Reset $post to null
468
  $renderer->add_inline_css( $inserted_page->ID, $renderer->generate_css( $inserted_page->ID ) );
469
  }
470
 
471
+ if ( class_exists( '\Elementor\Post_CSS_File' ) ) {
472
+ $css_file = new \Elementor\Post_CSS_File( $inserted_page->ID );
473
+ $css_file->enqueue();
474
+ }
475
+
476
  if ( is_null( $old_post_id ) ) {
477
  $post = null;
478
  } else {
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
- Tested up to: 4.8.2
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -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.2.7 =
90
  * Add insert_pages_override_display filter so site admins can enforce a specific display on all inserted pages.
91
 
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
+ Tested up to: 4.9
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
86
 
87
  == Changelog ==
88
 
89
+ = 3.2.8 =
90
+ * Add support for inserting pages/posts built with Elementor.
91
+
92
  = 3.2.7 =
93
  * Add insert_pages_override_display filter so site admins can enforce a specific display on all inserted pages.
94