Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.46 KB | None | 0 0
  1. <?php
  2. // Template Name: HomePage
  3. /**
  4.  *
  5.  * @package progression
  6.  * @since progression 1.0
  7.  */
  8.  
  9. get_header(); ?>
  10. <?php get_sidebar(); ?>
  11.  
  12. <section id="content">
  13.    
  14.     <!-- this code pull in the homepage content -->
  15.    
  16.     <?php while(have_posts()): the_post(); ?>
  17.  
  18.         <?php $cc = get_the_title(); if($cc != '') { ?>
  19.         <h1 class="page-title"><?php the_title(); ?></h1>
  20.         <?php } ?>
  21.        
  22.         <?php $cc = get_the_content(); if($cc != '') { ?>
  23.             <div id="home-page-content">
  24.                 <?php the_content(); ?>
  25.             </div>
  26.         <?php } ?>
  27.        
  28.     <?php endwhile; ?>
  29.    
  30.            
  31.    
  32.     <?php
  33.     global $more;    // Declare global $more (before the loop).
  34.     ?>
  35.     <div id="mason-layout" class="transitions-enabled fluid">
  36.     <?php
  37.     if ( get_query_var('paged') ) {
  38.         $paged = get_query_var('paged');
  39.     } else if ( get_query_var('page') ) {
  40.         $paged = get_query_var('page');
  41.     } else {
  42.         $paged = 1;
  43.     }
  44.    
  45.    
  46.     $postIds = get_post_meta($post->ID, 'pageoptions_blog_category', true); // get custom field value
  47.         $arrayIds = explode(',', $postIds); // explode value into an array of ids
  48.         if(count($arrayIds) <= 1) // if array contains one element or less, there's spaces after comma's, or you only entered one id
  49.         {
  50.             if( strpos($arrayIds[0], ',') !== false )// if the first array value has commas, there were spaces after ids entered
  51.             {
  52.                 $arrayIds = array(); // reset array
  53.                 $arrayIds = explode(', ', $postIds); // explode ids with space after comma's
  54.             }
  55.  
  56.         }
  57.  
  58.     $postspage = get_post_meta($post->ID, 'pageoptions_pstsperpage', true);
  59.    
  60.     query_posts( array( 'posts_per_page'=> $postspage, 'paged' => $paged, 'tax_query' => array(
  61.         array('taxonomy' => 'category',
  62.                             'terms' => $arrayIds,
  63.                             'field' => 'slug'
  64.        ))
  65.      ) );
  66.     // begin the loop
  67.     ?>
  68.     <?php $count = 0; ?>
  69.     if ( have_posts() ) : while ( have_posts() ) : the_post();
  70.     global $post;
  71.     ?>
  72.     <?php $count++; ?>
  73.   <?php if ($count == 2) : ?>
  74.           <div class="ad"><?php echo adrotate_group(1); ?></div>
  75.     $more = 0;       // Set (inside the loop) to display content above the more tag.
  76.     ?>
  77.    
  78.     <?php get_template_part( 'content', 'blog' ); ?>
  79.      
  80.     <?php endwhile; ?>
  81.     <div class="clearfix"></div>
  82.     </div><!-- close #mason-layout -->
  83.    
  84.    
  85.     <?php get_template_part( 'pagination', 'blog' ); ?>
  86.    
  87.    
  88.  
  89. <?php elseif ( current_user_can( 'edit_posts' ) ) : ?>
  90.     <?php get_template_part( 'no-results', 'index' ); ?>
  91.     <?php endif; ?>
  92.  
  93. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement