cyberdev

Untitled

Aug 21st, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. add_action( 'bimber_custom_home_after_main_collection', function() {
  2.     $vc_page_id = 981; //ID of your VC page
  3.  
  4.     $vc_page_id = apply_filters( 'bimber_home_vc_page_id', $vc_page_id );
  5.  
  6.     if ( ! $vc_page_id ) {
  7.         return;
  8.     }
  9.  
  10.     $vc_page_template = get_post_meta( $vc_page_id, '_wp_page_template', true );
  11.  
  12.     $template_name = ( 'g1-template-page-full.php' === $vc_page_template ) ? 'full' : 'with-sidebar';
  13.  
  14.     global $post;
  15.     $orig_post = $post;
  16.  
  17.     $post = get_post( $vc_page_id );
  18.     setup_postdata( $post );
  19.  
  20.     $quads_priority = function_exists( 'quads_get_load_priority' ) ? quads_get_load_priority() : 20;
  21.  
  22.     add_filter('the_content', 'bimber_disable_quads_content_ads', $quads_priority - 1 );
  23.  
  24.     // Load VC page related custom CSS.
  25.     $vc_page_css = get_post_meta( $vc_page_id, '_wpb_shortcodes_custom_css', true );
  26.  
  27.     if ( ! empty( $vc_page_css ) ) {
  28.         echo '<style type="text/css">';
  29.         echo $vc_page_css;
  30.         echo '</style>';
  31.     }
  32.  
  33.     get_template_part( 'template-parts/home-static/' . $template_name );
  34.  
  35.     remove_filter('the_content', 'bimber_disable_quads_content_ads', $quads_priority - 1 );
  36.  
  37.     $post = $orig_post;
  38.     wp_reset_postdata();
  39. });
Advertisement
Add Comment
Please, Sign In to add comment