Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php get_header(); ?>
- <!--include sidebar-->
- <?php include(TEMPLATEPATH."/blog_sidebar.php");?>
- <div id="content">
- <!--index.php-->
- <?php
- $premium_id = 9; // The term_taxonomy_id of the Premium Member category
- function mam_posts_fields ($fields) {
- global $mam_global_fields;
- // Make sure there is a leading comma
- if ($mam_global_fields) $fields .= (preg_match('/^(\s+)?,/',$mam_global_fields)) ? $mam_global_fields : ", $mam_global_fields";
- return $fields;
- }
- function mam_posts_join ($join) {
- global $mam_global_join;
- if ($mam_global_join) $join .= " $mam_global_join";
- return $join;
- }
- function mam_posts_orderby ($orderby) {
- global $mam_global_orderby;
- if ($mam_global_orderby) $orderby = $mam_global_orderby;
- return $orderby;
- }
- add_filter('posts_fields','mam_posts_fields');
- add_filter('posts_join','mam_posts_join');
- add_filter('posts_orderby','mam_posts_orderby');
- global $wpdb;
- $mam_global_fields = ', IF(ISNULL(tr.object_id),9,1) as sort_key';
- $mam_global_join = " LEFT JOIN $wpdb->term_relationships tr ON ($wpdb->posts.ID = tr.object_id AND tr.term_taxonomy_id = $premium_id)";
- $mam_global_orderby = "sort_key, UPPER($wpdb->posts.post_title)";
- global $wp_query;
- query_posts($wp_query->query);
- ?>
- <?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>
- <!--post title as a link-->
- <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>
- <!--post meta info-->
- <div class="meta-top">
- </div>
- <!--post text with the read more link-->
- <?php the_content('<div class="post-more">Read the rest of this entry »</div>'); ?>
- <!--post meta info-->
- <div class="meta-bottom"></div>
- <?php endwhile; // end of one post ?>
- <!-- Previous/Next page navigation -->
- <div class="page-nav">
- <div class="nav-previous"><?php previous_posts_link('« Previous Page') ?></div>
- <div class="nav-next"><?php next_posts_link('Next Page »') ?></div>
- </div>
- <?php else : // do not delete ?>
- <h3>Page Not Found</h3>
- <p>We're sorry, but the page you are looking for isn't here.</p>
- <p>Try searching for the page you are looking for or using the navigation in the header or sidebar</p>
- <?php endif; // do not delete ?>
- <!--index.php end-->
- </div>
- <!--include footer-->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment