milardovich

THUMBS PROBLEM

Jan 30th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.09 KB | None | 0 0
  1. <?php get_header(); ?>
  2.                
  3.                 <div id="container">
  4.                     <?php
  5.                         $paged = 0;
  6.                         if(isset($_GET['paged'])){
  7.                             $paged = intval($_GET['paged']);
  8.                         }
  9.                         $i=0;
  10.                         $loop = new WP_Query();
  11.                         $loop->query('cat=-44&paged='.$paged);
  12.                         if($loop->have_posts()) :
  13.                         while($loop->have_posts()) :
  14.                         $loop->the_post();
  15.                         $i++;
  16.                         $the_tags = get_the_tags();
  17.                         $tags = null;
  18.                         $a=0;
  19.                         foreach($the_tags as $tag){
  20.                             if($a<4){
  21.                                 $tags[] = '<a href="?tag='.$tag->term_id.'">'.$tag->name.'</a>';   
  22.                                 $a++;
  23.                             } else {
  24.                                 break;
  25.                             }
  26.                         }
  27.                     ?>
  28.                         <div class="post-item">
  29.                             <div class="post-title"><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1></div>
  30.                             <?php
  31.                                 $args = array( 'post_type' => 'attachment', 'post_parent' => get_the_ID() );
  32.                                 $attachments = get_posts($args);
  33.                                 $float = 'no';
  34.                                 if ($attachments) {
  35.                                     $gambar = wp_get_attachment_image_src( $attachments[0]->ID, '', false);
  36.                                     if($gambar[1] < 250){
  37.                                         $float = 'yes';
  38.                                     } else {
  39.                                         $float = 'no';
  40.                                     }
  41.                                     $showgambar = 'yes';
  42.                                 } else {
  43.                                     $showgambar = 'no';
  44.                                 }
  45.                             ?>
  46.                             <div class="post-content" <?php
  47.                                 if($float=='yes'){
  48.                                     $widthremain = 564 - $gambar[1]; ?>
  49.                                     style="width: <?php echo $widthremain ?>px;"
  50.                                 <?php };
  51.                             ?>>
  52.                                 <?php the_excerpt(); ?>
  53.                             </div>
  54.                             <?php if($showgambar=='yes'){?>
  55.                             <div class="post-thumbnail" <?php
  56.                                 if($float=='no'){
  57.                                     $widthremain = 564 - $gambar[1]; ?>
  58.                                     style="width: 100%; text-align: center;"
  59.                                 <?php };
  60.                             ?>>
  61.                                 <img src="<?php echo $gambar[0]?>" />
  62.                             </div>
  63.                             <?php } ?>
  64.                             <div class="clear"></div>
  65.                             <div class="post-meta">Por <?php the_author_posts_link(); ?> - <?php the_time('m F, Y'); ?></div>
  66.                             <div class="clear"></div>
  67.                             <div class="post-meta-2">
  68.                                 <div class="post-tag">Etiquetas: <?=implode(', ',$tags);?> <br/> </div>
  69.                                 <div class="toggle-link"><a href="#" class="compartir<?php echo $i; ?>">Compartir</a></div>
  70.                                 <div class="clear"></div>
  71.                             </div>
  72.                             <div class="toggle-content-compartir<?php echo $i; ?>">
  73.                                 <?php if(function_exists('kc_add_social_share')) kc_add_social_share(); ?>
  74.                             </div>
  75.                             <div class="post-comment"></div>
  76.                         </div>
  77.                     <?php endwhile; ?>
  78.                     <?php
  79.                         $count_posts = wp_count_posts();
  80.                         $published_posts = $count_posts->publish;
  81.                     ?>
  82.                    
  83.                     <div class="navigation-post">
  84.                         <div class="next-page"><?php next_posts_link('&nbsp;','') ?></div>
  85.                         <div class="prev-page"><?php previous_posts_link('&nbsp;') ?></div>
  86.                         <div class="counter"><?php echo $i; ?> de <?php echo $published_posts; ?> Posts</div>
  87.                         <div class="clear"></div>
  88.                     </div>
  89.                    
  90.                     <?php else: ?>
  91.                         <p>Sorry, no posts matched your criteria.</p>
  92.                     <?php endif;?>
  93.                 </div>
  94. <?php get_sidebar(); ?>
  95.             </div></div>
  96.             </div>
  97.            
  98. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment