Recent posts plus recent posts for all of my categories
-
Hi guys, so I’ve been banging my head on this for awhile now. Currently on my home page I am showing the most recent three posts from all of my categories. I love it, it is exactly what I want. However I would also like to have above that my most recent three posts from ALL categories, is it possible to alter my code a bit to include that too? Here is the code.
<?php $allcats = get_categories('child_of='.get_query_var('cat')); foreach ($allcats as $cat) : $args = array( 'posts_per_page' => 3, // max number of post per category 'category__in' => array($cat->term_id) ); $customInCatQuery = new WP_Query($args); if ($customInCatQuery->have_posts()) : echo '<div>'; echo '<div id="posts-header-container"><h6><span>Most recent from '.$cat->name.'</span></h6></div>'; echo ''; while ($customInCatQuery->have_posts()) : $customInCatQuery->the_post(); ?> <div class="date"><strong><?php the_time('M d Y'); ?></strong></div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div id="humbnail"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> </div> <?php the_content('Read More »'); ?> <?php endwhile; echo '</div>'; ?>
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Recent posts plus recent posts for all of my categories’ is closed to new replies.