You can’t see it because the code didn’t appear but that is exactly what I am doing.
you can paste your full code in a paste bin if you want
Maybe this will show up.
<!-- Start the Loop. -->
<?php
$myquery = new WP_Query();
$myquery->query('showposts=2');
?>
<?php
while ($myquery->have_posts()) : $myquery->the_post();
?>
<?php if ( in_category('projects') ) { ?>
<li>
<div id="homepage_projects_text" class="group">
<div class="home_projects_image">
<?php if(has_post_thumbnail()) { ?>
<?php the_post_thumbnail('thumbnail');?>
<?php } else { ?>
<img src="<?php bloginfo('template_url'); ?>/images/no_image.png" alt="no image available"/>
<?php } ?>
</div>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
</div>
</li>
<?php } ?>
<?php endwhile; ?>
<!-- Start the Loop. -->
<?php
$anotherquery = new WP_Query();
$anotherquery->query('showposts=2');
?>
<?php
while ($anotherquery->have_posts()) : $anotherquery->the_post();
?>
<?php if ( in_category('blog') ) { ?>
<li>
<div id="blog_title">
<div class="blog_date"><?php the_date(); ?></div>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
<p><?php the_excerpt(); ?></p>
</li>
<?php } ?>
<?php endwhile; ?>
Hi
The main problem you are having is it is selecting two posts in the second query, and since they are not in the blog category its not displaying them. You need to move the category selector into the query parameters
second loop:
<?php
$anotherquery = new WP_Query();
$anotherquery->query('showposts=2&category_name=blog');
?>
<?php
while ($anotherquery->have_posts()) : $anotherquery->the_post();
?>
<li>
<div id="blog_title">
<div class="blog_date"><?php the_date(); ?></div>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
<p><?php the_excerpt(); ?></p>
</li>
<?php endwhile; ?>
its better to use posts_per_page as showposts is now deprecated – they do the same thing
Thank you, thank you …That was it.
One small issue if that the date is not showing up after the first post.
I’m not seeing anything in the code that prevents the date from showing up in the second post. Check the browser source code and see if the div in
<div class="blog_date"><?php the_date(); ?></div>
appears. If not, you have to determine why not.