Marcos_Alexandre

front-page.php

Oct 28th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.59 KB | None | 0 0
  1. <?php
  2. /** Template Name: Home */
  3. get_header();
  4. global $pmc_data;
  5. wp_enqueue_script('pmc_bxSlider');     
  6. ?>
  7. <!-- main content start -->
  8. <div class="mainwrap blog <?php if(is_front_page()) echo 'home' ?> <?php if(!isset($pmc_data['use_fullwidth'])) echo 'sidebar' ?>">
  9.     <div class="main clearfix">
  10.         <div class="pad"></div>        
  11.         <div class="content blog">
  12.             <?php if (have_posts()) : ?>
  13.             <h2 class="title">New Post's</h2>
  14.             <?php
  15.  
  16.             $argsFeature = array (
  17.                 'post_type' => array( 'gastronomia', 'entretenimento', 'lifestyle' ),
  18.                 'posts_per_page' => 1,
  19.                 'featured'=>'yes'
  20.             );
  21.             $my_queryFeature = new WP_Query ($argsFeature);
  22.  
  23.             while ( $my_queryFeature->have_posts() ) : $my_queryFeature->the_post(); ?>  
  24.  
  25.  
  26.            
  27.             <?php if(is_sticky(get_the_id())) { ?>
  28.             <div class="pmc_sticky">
  29.             <?php } ?>
  30.             <?php
  31.             $postmeta = get_post_custom(get_the_id()); ?>
  32.             <div class="blog_category"><?php echo '<em>' . get_the_category_list( __( ', ', 'pmc-themes' ) ) . '</em>'; ?></div>           
  33.             <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  34.             <?php
  35.             if ( has_post_format( 'gallery' , get_the_id())) {
  36.             ?>
  37.             <div class="slider-category">
  38.                
  39.                 <div class="blogpostcategory">
  40.                 <?php  
  41.                     global $post;
  42.                     $attachments = '';
  43.                     $post_subtitrare = get_post( get_the_id() );
  44.                     $content = $post_subtitrare->post_content;
  45.                     $pattern = get_shortcode_regex();
  46.                     preg_match( "/$pattern/s", $content, $match );
  47.                     if( isset( $match[2] ) && ( "gallery" == $match[2] ) ) {
  48.                         $atts = shortcode_parse_atts( $match[3] );
  49.                         $attachments = isset( $atts['ids'] ) ? explode( ',', $atts['ids'] ) : get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . get_the_id() .'&order=ASC&orderby=menu_order ID' );
  50.                     }
  51.                     if ($attachments) {?>
  52.                     <div id="slider-category" class="slider-category">
  53.                     <div class="loading"></div>
  54.                         <ul id="slider" class="bxslider">
  55.                             <?php
  56.                                 foreach ($attachments as $attachment) {
  57.                                     $image =  wp_get_attachment_image_src( $attachment, 'blog' ); ?>   
  58.                                         <li>
  59.                                             <img src="<?php echo $image[0] ?>"/>                           
  60.                                         </li>
  61.                                         <?php } ?>
  62.                         </ul>
  63.                        
  64.                     </div>
  65.               <?php } ?>
  66.               <div class="bottomborder"></div>
  67.                 <?php get_template_part('includes/boxes/loopBlog'); ?>
  68.                 </div>
  69.             </div>
  70.             <?php }
  71.             if ( has_post_format( 'video' , get_the_id())) { ?>
  72.             <div class="slider-category">
  73.            
  74.                 <div class="blogpostcategory">
  75.                 <?php
  76.                
  77.                 if(!empty($postmeta["video_post_url"][0])) {?>
  78.                 <?php  
  79.                     $video_arg  = '';
  80.                     $video = wp_oembed_get( esc_url($postmeta["video_post_url"][0]), $video_arg );     
  81.                     $video = preg_replace('/width=\"(\d)*\"/', 'width="800"', $video);         
  82.                     $video = preg_replace('/height=\"(\d)*\"/', 'height="490"', $video);   
  83.                     echo $video;
  84.                 }
  85.                 else{
  86.                       $image = 'http://placehold.it/800x490';
  87.                      
  88.                 ?>
  89.                       <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo pmc_getImage(get_the_id(),'blog'); ?></a>
  90.                    
  91.                 <?php } ?> 
  92.                 <div class="bottomborder"></div>
  93.                 <?php get_template_part('includes/boxes/loopBlog'); ?>
  94.                 </div>
  95.             </div>
  96.             <?php }
  97.             if ( has_post_format( 'link' , get_the_id())) {?>
  98.             <div class="link-category">
  99.                 <div class="blogpostcategory">
  100.                 <?php get_template_part('includes/boxes/loopBlogLink'); ?>                             
  101.                 </div>
  102.             </div>
  103.            
  104.             <?php
  105.             }  
  106.             ?>
  107.             <?php if ( has_post_format( 'audio' , get_the_id())) {?>
  108.             <div class="blogpostcategory">
  109.                 <div class="audioPlayerWrap">
  110.                     <div class="loading"></div>
  111.                     <div class="audioPlayer">
  112.                         <?php
  113.                         if(isset($postmeta["audio_post_url"][0]))
  114.                             echo do_shortcode('[audio file="'. esc_url($postmeta["audio_post_url"][0]) .'"]') ?>
  115.                     </div>
  116.                 </div>
  117.                 <?php get_template_part('includes/boxes/loopBlog'); ?>     
  118.             </div> 
  119.             <?php
  120.             }
  121.             ?>                 
  122.            
  123.            
  124.             <?php
  125.             if ( !get_post_format() ) {?>
  126.        
  127.             <div class="blogpostcategory">
  128.                    
  129.                 <?php if(pmc_getImage(get_the_id(), 'blog') != '') { ?>
  130.                     <a class="overdefultlink" href="<?php the_permalink() ?>">
  131.                     <div class="overdefult">
  132.                     </div>
  133.                     </a>
  134.                     <div class="blogimage">
  135.                         <div class="loading"></div>    
  136.                         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo pmc_getImage(get_the_id(), 'blog'); ?></a>
  137.                     </div>
  138.                    
  139.                     <div class="bottomborder"></div>
  140.                     <?php } ?>
  141.                     <?php get_template_part('includes/boxes/loopBlog'); ?>
  142.             </div> 
  143.             <?php } ?>     
  144.             <?php if(is_sticky()) { ?>
  145.                 </div>
  146.             <?php } ?>
  147.             <div class="blog_social"> <?php pmc_socialLinkSingle(get_the_permalink(),get_the_title())  ?></div>
  148.  
  149.  
  150.            
  151.             <?php endwhile; wp_reset_query(); ?>
  152.  
  153.            
  154.             <div id="rollll"><?php putRevSlider("slider-patrocinio-topo","homepage") ?></div>
  155.  
  156.             <?php
  157.  
  158.                 $page = (get_query_var('page')) ? get_query_var('page') : 1;
  159.  
  160.                 $args = array (
  161.                     'post_type' => array( 'gastronomia', 'entretenimento', 'lifestyle' ),
  162.                     'posts_per_page' => 10,
  163.                     'paged' => $page
  164.                 );
  165.  
  166.                 $my_query = new WP_Query ($args);
  167.                 $GLOBALS['wp_query']->max_num_pages = $my_query->max_num_pages;
  168.                
  169.             ?>
  170.             <?php $i = 0; ?>
  171.            
  172.            
  173.             <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
  174.             <?php $i++; ?>
  175.             <div class="estepost">
  176.             <?php if(is_sticky(get_the_id())) { ?>
  177.             <div class="pmc_sticky">
  178.             <?php } ?>
  179.             <?php
  180.             $postmeta = get_post_custom(get_the_id()); ?>
  181.             <div class="blog_category"><?php echo '<em>' . get_the_category_list( __( ', ', 'pmc-themes' ) ) . '</em>'; ?></div>           
  182.             <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  183.             <?php
  184.             if ( has_post_format( 'gallery' , get_the_id())) {
  185.             ?>
  186.             <div class="slider-category">
  187.                
  188.                 <div class="blogpostcategory">
  189.                 <?php  
  190.                     global $post;
  191.                     $attachments = '';
  192.                     $post_subtitrare = get_post( get_the_id() );
  193.                     $content = $post_subtitrare->post_content;
  194.                     $pattern = get_shortcode_regex();
  195.                     preg_match( "/$pattern/s", $content, $match );
  196.                     if( isset( $match[2] ) && ( "gallery" == $match[2] ) ) {
  197.                         $atts = shortcode_parse_atts( $match[3] );
  198.                         $attachments = isset( $atts['ids'] ) ? explode( ',', $atts['ids'] ) : get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . get_the_id() .'&order=ASC&orderby=menu_order ID' );
  199.                     }
  200.                     if ($attachments) {?>
  201.                     <div id="slider-category" class="slider-category">
  202.                     <div class="loading"></div>
  203.                         <ul id="slider" class="bxslider">
  204.                             <?php
  205.                                 foreach ($attachments as $attachment) {
  206.                                     $image =  wp_get_attachment_image_src( $attachment, 'blog' ); ?>   
  207.                                         <li>
  208.                                             <img src="<?php echo $image[0] ?>"/>                           
  209.                                         </li>
  210.                                         <?php } ?>
  211.                         </ul>
  212.                        
  213.                     </div>
  214.               <?php } ?>
  215.               <div class="bottomborder"></div>
  216.                 <?php get_template_part('includes/boxes/loopBlog'); ?>
  217.                 </div>
  218.             </div>
  219.             <?php }
  220.             if ( has_post_format( 'video' , get_the_id())) { ?>
  221.             <div class="slider-category">
  222.            
  223.                 <div class="blogpostcategory">
  224.                 <?php
  225.                
  226.                 if(!empty($postmeta["video_post_url"][0])) {?>
  227.                 <?php  
  228.                     $video_arg  = '';
  229.                     $video = wp_oembed_get( esc_url($postmeta["video_post_url"][0]), $video_arg );     
  230.                     $video = preg_replace('/width=\"(\d)*\"/', 'width="800"', $video);         
  231.                     $video = preg_replace('/height=\"(\d)*\"/', 'height="490"', $video);   
  232.                     echo $video;
  233.                 }
  234.                 else{
  235.                       $image = 'http://placehold.it/800x490';
  236.                      
  237.                 ?>
  238.                       <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo pmc_getImage(get_the_id(),'blog'); ?></a>
  239.                    
  240.                 <?php } ?> 
  241.                 <div class="bottomborder"></div>
  242.                 <?php get_template_part('includes/boxes/loopBlog'); ?>
  243.                 </div>
  244.             </div>
  245.             <?php }
  246.             if ( has_post_format( 'link' , get_the_id())) {?>
  247.             <div class="link-category">
  248.                 <div class="blogpostcategory">
  249.                 <?php get_template_part('includes/boxes/loopBlogLink'); ?>                             
  250.                 </div>
  251.             </div>
  252.            
  253.             <?php
  254.             }  
  255.             ?>
  256.             <?php if ( has_post_format( 'audio' , get_the_id())) {?>
  257.             <div class="blogpostcategory">
  258.                 <div class="audioPlayerWrap">
  259.                     <div class="loading"></div>
  260.                     <div class="audioPlayer">
  261.                         <?php
  262.                         if(isset($postmeta["audio_post_url"][0]))
  263.                             echo do_shortcode('[audio file="'. esc_url($postmeta["audio_post_url"][0]) .'"]') ?>
  264.                     </div>
  265.                 </div>
  266.                 <?php get_template_part('includes/boxes/loopBlog'); ?>     
  267.             </div> 
  268.             <?php
  269.             }
  270.             ?>                 
  271.            
  272.            
  273.             <?php
  274.            
  275.             if ( !get_post_format() ) {?>
  276.        
  277.             <div class="blogpostcategory">
  278.                    
  279.                 <?php if(pmc_getImage(get_the_id(), 'blog') != '') { ?>
  280.                     <a class="overdefultlink" href="<?php the_permalink() ?>">
  281.                     <div class="overdefult">
  282.                     </div>
  283.                     </a>
  284.                     <div class="blogimage">
  285.                         <div class="loading"></div>    
  286.                         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo pmc_getImage(get_the_id(), 'blog'); ?></a>
  287.                     </div>
  288.                    
  289.                     <div class="bottomborder"></div>
  290.                     <?php } ?>
  291.                     <?php get_template_part('includes/boxes/loopBlog'); ?>
  292.             </div> 
  293.             <?php }
  294.            
  295.             ?>     
  296.             <?php if(is_sticky()) { ?>
  297.                 </div>
  298.             <?php } ?>
  299.  
  300.             <div class="blog_social"> <?php pmc_socialLinkSingle(get_the_permalink(),get_the_title())  ?></div>
  301.            
  302.             <?php if($i == 4)
  303.             {
  304.             ?>
  305.             <div class="spacer">
  306.             <?php echo putRevSlider("slider-patrocinio-rodape","homepage"); ?>
  307.             </div>
  308.            
  309.             <?php
  310.             }
  311.             ?>
  312.            
  313.             </div>
  314.            
  315.            
  316.            
  317.                 <?php endwhile; ?>
  318.                    
  319.                     <?php else : ?>
  320.                    
  321.                         <div class="postcontent">
  322.                             <h1><?php echo $pmc_data['errorpagetitle'] ?></h1>
  323.                             <div class="posttext">
  324.                                 <?php echo $pmc_data['errorpage'] ?>
  325.                             </div>
  326.                         </div>
  327.                        
  328.                     <?php endif; ?>
  329.  
  330.         </div>
  331.  
  332.         <div class="spacer">
  333.             <?php
  334.                 putRevSlider("slider-rodape-posts-inicio","homepage")
  335.             ?>
  336.         </div>
  337.  
  338.    
  339.         <!-- sidebar -->
  340.        
  341.         <?php if(!isset($pmc_data['use_fullwidth'])) { ?>
  342.             <div class="sidebar">  
  343.                 <?php dynamic_sidebar( 'sidebar' ); ?>
  344.             </div>
  345.         <?php } ?>
  346.  
  347.             <?php if ( function_exists( 'wp_pagination' ) )
  348.                   wp_pagination($my_query);
  349.             ?>
  350.  
  351.     </div>
  352.    
  353.    
  354. </div>                                         
  355. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment