How to get category posts under first post?
-
I have this code in my index file:
<?php $my_query = new WP_Query('category_name=photos&showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;?> <div id="featuredphoto"> <?php echo do_shortcode('[gallery]'); ?> <h2>» <?php the_title(); ?></h2> <div class="photoentry"> <?php the_excerpt(); ?> </div> </div> <?php endwhile; ?> <!-- Do other stuff... --> <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <?php if ( in_category('41') ) { ?> <div id="gallerypost"> <?php echo do_shortcode('[gallery]'); ?> <h2>» <?php the_title(); ?></h2> <div class="photoentry"> <?php the_excerpt(); ?> </div> </div> <div class="clear"> </div> <?php } else { ?> <!-- If the post is in the category we want to exclude, we simply pass to the next post. --> <?php $custom_fields = get_post_custom(); //custom fields ?> <?php if (isset($custom_fields["BX_post_type"]) && $custom_fields["BX_post_type"][0] == "mini") { ?> <hr class="low" /> <div class="minientry"> <p> <a href="<?php the_permalink(); ?>" title="Permalink"><?php the_time('M j, \'y') ?></a> » <?php echo BX_remove_p($post->post_content); ?> <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'commentlink'); ?> </p> </div> <hr class="low" /> <?php } else { ?> <div class="entry"> <h2><a href="<?php the_permalink() ?>" title="Permalink"><?php the_title(); ?></a></h2> <?php the_content('Read More »'); ?> <p class="post-tags"> <?php if (function_exists('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?> </p> <p class="info"><?php if ($post->post_excerpt != "") { ?><a href="<?php the_permalink() ?>" class="more">Continue Reading</a><?php } ?> <?php comments_popup_link('Add comment', '1 comment', '% comments', 'commentlink', ''); ?> <em class="date"><?php the_time('F jS, Y') ?><!-- at <?php the_time('h:ia') ?>--></em> <!--<em class="author"><?php the_author(); ?></em>--> <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?> </p> </div> <!-- <?php trackback_rdf(); ?> --> <?php } ?> <?php } ?> <?php endwhile; ?> <p><!-- this is ugly --> <span class="next"><?php previous_posts_link('Next Posts') ?></span> <span class="previous"><?php next_posts_link('Previous Posts') ?></span> </p> <?php else : ?> <h2>Not Found</h2> <p>Sorry, but you are looking for something that isn't here.</p> <?php endif; ?>
and i wanna get 2 different category posts to show up under the first post then have the rest of the posts go as normal under that. how can i do it?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to get category posts under first post?’ is closed to new replies.