PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 1.6.4
Kubio AI Page Builder v1.6.4
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / integrations / third-party-themes / preview.php
kubio / lib / integrations / third-party-themes Last commit date
block-based-templates 4 years ago styles 4 years ago customizer-options.php 4 years ago editor-hooks.php 4 years ago fallback-compatibility.php 4 years ago frontend-hooks.php 4 years ago preview.php 4 years ago templates-importer.php 4 years ago templates.php 3 years ago third-party-themes.php 4 years ago
preview.php
54 lines
1 <?php
2
3
4 // function kubio_preview_third_pa
5
6 use IlluminateAgnostic\Arr\Support\Arr;
7
8 function kubio_third_party_theme_preview_content( $content ) {
9 $autosaved_posts = kubio_get_current_changeset_data( 'autosaves', array() );
10 $post_id = get_the_ID();
11
12 foreach ( $autosaved_posts as $map ) {
13 if ( Arr::get( $map, 'parent' ) === $post_id ) {
14 $autosaved = get_post( Arr::get( $map, 'id' ) );
15 if ( ! is_wp_error( $autosaved ) ) {
16 $content = $autosaved->post_content;
17 }
18 break;
19 }
20 }
21
22 return $content;
23 }
24
25 function kubio_third_party_theme_prepare_preview_post_content( $template ) {
26 if ( kubio_is_page_preview() ) {
27 global $_wp_current_template_content, $post;
28
29 $is_previewing_3rd_party_theme_template = kubio_3rd_party_theme_is_previewing_theme_template();
30
31 if ( ( ! $_wp_current_template_content || $is_previewing_3rd_party_theme_template ) && $post && $post->post_type === 'page' ) {
32 $page_id = $post ? intval( $post->ID ) : null;
33
34 add_filter(
35 'the_content',
36 function ( $content ) use ( $page_id ) {
37 global $kubio_third_party_theme_preview_post_content_executed;
38 $current_post = get_post();
39 if ( ! $kubio_third_party_theme_preview_post_content_executed && $page_id === $current_post->ID ) {
40 $kubio_third_party_theme_preview_post_content_executed = true;
41 return kubio_third_party_theme_preview_content( $content );
42 }
43 return $content;
44 },
45 0
46 );
47 }
48 }
49
50 return $template;
51 }
52
53 add_action( 'template_include', 'kubio_third_party_theme_prepare_preview_post_content', 500 );
54