Advertisement
Guest User

index.php

a guest
Dec 27th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.99 KB | None | 0 0
  1. <?php get_header(); ?>
  2.     <div id="primary" class="hfeed">
  3.         <div id="masonry">
  4.        
  5.             <?php
  6.            
  7.             $post_count = 0;
  8.  
  9.             $empty = 'data-empty="'.__('No more posts available.', 'themejunkie').'" ';
  10.            
  11.             $src = 'data-src="'.get_template_directory_uri().'/includes/get-posts.php" ';
  12.            
  13.             $offset = 'data-offset="'.get_option('posts_per_page').'" ';
  14.            
  15.             $catQ = 0;
  16.             $cat = '';
  17.             if(is_category())
  18.                 $catQ = get_query_var('cat');
  19.                 $cat = 'data-category="'.$catQ.'" ';
  20.            
  21.             $authorQ = 0;
  22.             $author = '';
  23.             if(is_author())
  24.                 $authorQ = get_query_var('author');
  25.                 $author = 'data-author="'.$authorQ.'" ';
  26.            
  27.             $tagQ = '';
  28.             $tag = '';
  29.             if(is_tag())
  30.                 $tagQ = get_query_var('tag');
  31.                 $tag = 'data-tag="'.$tagQ.'" ';
  32.                
  33.             $dateQ = '';
  34.             $date = '';
  35.             if(is_archive())
  36.                 $dateQ = get_query_var('monthnum');
  37.                 $date = 'data-date="'.$dateQ.'" ';
  38.                
  39.             $searchQ = '';
  40.             $search = '';
  41.             if(is_search())
  42.                 $searchQ = get_query_var('s');
  43.                 $search = 'data-search="'.$searchQ.'" ';
  44.            
  45.             // The Query
  46.             $the_query = new WP_Query( array(
  47.                                 'posts_per_page' => -1,
  48.                                 'cat' => $catQ,
  49.                                 'author' => $authorQ,
  50.                                 'tag' => $tagQ,
  51.                                 'monthnum' => $dateQ,
  52.                                 's' => $searchQ
  53.                             )
  54.                         );
  55.            
  56.             // The Loop
  57.             while ( $the_query->have_posts() ) : $the_query->the_post();
  58.                 $post_count++;
  59.             endwhile;
  60.  
  61.             // Reset Post Data
  62.             wp_reset_postdata();
  63.  
  64.             $post_count = $post_count - get_option('posts_per_page');
  65.  
  66.             if($post_count <= 0)
  67.                 $post_count = 0;
  68.  
  69.             ?>
  70.            
  71.  
  72.             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  73.             <?php
  74.  
  75.                 // The following determines what the post format is and shows the correct file accordingly
  76.                 $format = get_post_format();
  77.                 get_template_part( 'includes/formats/'.$format );
  78.  
  79.                 if($format == '')
  80.                 get_template_part( 'includes/formats/standard' );
  81.  
  82.             ?>
  83.             <?php endwhile; endif; ?>
  84.  
  85.         </div><!-- #masonry-->
  86.        
  87.         <div class="ready" id="new-posts"></div>
  88.  
  89.     </div><!-- #primary .hfeed -->
  90.  
  91.     <div id="load-more-link">
  92.         <span id="load-more-ico"></span>
  93.         <a name="<?php echo get_template_directory_uri();?>" <?php echo $empty; echo $src; echo $offset; echo $cat; echo $author; echo $tag; echo $date; echo $search ?>href="#loadMore">
  94.         <?php _e('Load more...', 'themejunkie'); ?>
  95.         <span>
  96.             <span data-num="<?php echo get_option('posts_per_page');?>" data-src="<?php echo get_template_directory_uri(); ?>/images/ajax-loader.gif" id="post-count">
  97.                 <?php echo $post_count; ?>
  98.             </span>
  99.             <span data-text="<?php _e('Remaining', 'themejunkie'); ?>" id="remaining"><?php _e('Remaining', 'themejunkie'); ?></span>
  100.             </span>
  101.         </a>
  102.         <?php get_footer(); ?>
  103.     </div><!-- #load-more-link -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement