PhoenyxDown

CHCoC After Attempt

Sep 2nd, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.53 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <!--include sidebar-->
  3. <?php include(TEMPLATEPATH."/blog_sidebar.php");?>
  4.  
  5. <div id="content">
  6.     <!--index.php-->
  7.    
  8.         <?php
  9.             $premium_id = 9;  // The term_taxonomy_id of the Premium Member category
  10.            
  11.             function mam_posts_fields ($fields) {
  12.                global $mam_global_fields;
  13.                // Make sure there is a leading comma
  14.                if ($mam_global_fields) $fields .= (preg_match('/^(\s+)?,/',$mam_global_fields)) ? $mam_global_fields : ", $mam_global_fields";
  15.                return $fields;
  16.             }
  17.             function mam_posts_join ($join) {
  18.                global $mam_global_join;
  19.                if ($mam_global_join) $join .= " $mam_global_join";
  20.                return $join;
  21.             }
  22.             function mam_posts_orderby ($orderby) {
  23.                global $mam_global_orderby;
  24.                if ($mam_global_orderby) $orderby = $mam_global_orderby;
  25.                return $orderby;
  26.             }
  27.             add_filter('posts_fields','mam_posts_fields');
  28.             add_filter('posts_join','mam_posts_join');
  29.             add_filter('posts_orderby','mam_posts_orderby');
  30.            
  31.             global $wpdb;
  32.            
  33.             $mam_global_fields = ', IF(ISNULL(tr.object_id),9,1) as sort_key';
  34.             $mam_global_join = " LEFT JOIN $wpdb->term_relationships tr ON ($wpdb->posts.ID = tr.object_id AND tr.term_taxonomy_id = $premium_id)";
  35.             $mam_global_orderby = "sort_key, UPPER($wpdb->posts.post_title)";
  36.            
  37.             global $wp_query;
  38.             query_posts($wp_query->query);
  39.     ?>
  40.  
  41.     <?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>
  42.        
  43.     <!--post title as a link-->
  44.     <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
  45.  
  46.     <!--post meta info-->
  47.     <div class="meta-top">
  48.     </div>
  49.  
  50.     <!--post text with the read more link-->
  51.     <?php the_content('<div class="post-more">Read the rest of this entry &raquo;</div>'); ?>
  52.  
  53.     <!--post meta info-->
  54.     <div class="meta-bottom"></div>
  55.    
  56.     <?php endwhile; // end of one post ?>
  57.  
  58.     <!-- Previous/Next page navigation -->
  59.     <div class="page-nav">
  60.         <div class="nav-previous"><?php previous_posts_link('&laquo; Previous Page') ?></div>
  61.         <div class="nav-next"><?php next_posts_link('Next Page &raquo;') ?></div>
  62.     </div>    
  63.  
  64.     <?php else : // do not delete ?>
  65.  
  66.     <h3>Page Not Found</h3>
  67.     <p>We're sorry, but the page you are looking for isn't here.</p>
  68.     <p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>
  69.  
  70.     <?php endif; // do not delete ?>
  71.    
  72.  
  73. <!--index.php end-->
  74. </div>
  75.  
  76. <!--include footer-->
  77. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment