Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $allposts = get_posts('post_type=post&numberposts=120'); //get a lot of recent posts
- $cats = array(); $cat = array(); //initialize arrays
- foreach($allposts as $allpost) {
- $postcats = get_the_category($allpost->ID); //get all post's categories
- foreach($postcats as $ca) { $cat[] = $ca->term_id; } $postcats = $cat; $cat = array(); //this uses less queries than wp_get_post_categories()
- $cats = array_merge($cats,$postcats);
- $cats = array_unique($cats); } //only keep unique category IDs
- // $cats should now hold the list of cat IDs in chronological order
- //you need to fill in the following section with the category slugs and css classes and titles that you use in your ten loops
- /*set the css classes asociated with the categories*/
- $cat_class['aciform'] = 'maintitle_acifo';
- $cat_class['uncategorized'] = 'maintitle_uncat';
- $cat_class['contact'] = 'maintitle_conta';
- /*set the main titles asociated with the categories*/
- $cat_title['aciform'] = 'Aciform Title';
- $cat_title['uncategorized'] = 'Uncat Title';
- $cat_title['contact'] = 'Conta Title';
- $i = 0;
- foreach( $cats as $cat ) : //start the big loop through the latest categories
- $this_cat = get_category($cat); echo $this_cat->slug; ?>
- <div class="<?php echo $cat_class[$this_cat->slug]; ?>"><?php echo $cat_title[$this_cat->slug]; ?><?php if($i == 0) { ?><a href="" style="float:right;margin-right:10px;font-size:14px;margin-top:4px;">See All Videos</a><?php } ?></div>
- <div class="padder">
- <div class="page" id="blog-latest">
- <?php query_posts('category_name='.$this_cat->slug.'&showposts=12&order=DESC'); if ( have_posts() ) : ?>
- <?php $i=0; while (have_posts()) : the_post(); $i++; ?>
- <?php do_action( 'bp_before_blog_post' ) ?>
- <div class="postbox_white">
- <div class="boxtitle_white">
- <h2><a href="<?php the_permalink() ?>" style='color:#fff' orel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo tube_get_limited_string($post->post_title,20); ?></a></h2>
- </div>
- <div class="boxentry_white">
- <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
- <?php $thumb = tube_getcustomfield('thumb',get_the_ID()); if(!empty($thumb)) { ?>
- <img src="<?php echo $thumb; ?>" alt="<?php the_title_attribute(); ?>" width="130" height="78" /> <?php } else { ?>
- <img src="<?php bloginfo('template_url') ?>/images/pic_post1.jpg" width="130" height="78" alt="image" /><?php } ?>
- </a>
- <div class='post_date'>
- <?php the_author() ?></div>
- </div>
- </div>
- <?php do_action( 'bp_after_blog_post' ) ?>
- <?php if($i%4==0) : ?><div class="clear"></div><?php endif; ?>
- <?php endwhile; ?>
- <div class="navigation">
- <div class="alignleft"><?php next_posts_link( __( '← Previous Entries', 'buddypress' ) ) ?></div>
- <div class="alignright"><?php previous_posts_link( __( 'Next Entries →', 'buddypress' ) ) ?></div>
- </div>
- <?php else : ?>
- <h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
- <p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'buddypress' ) ?></p>
- <?php locate_template( array( 'searchform.php' ), true ) ?>
- <?php endif; ?>
- </div>
- <?php do_action( 'bp_after_blog_home' ) ?>
- </div><!-- .padder -->
- <?php endforeach; //end of the big loop ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement