Hi,
I have a problem that I haven't been able to wrap my head around yet. In a nutshell, I have a loop with a div wrapper (.partnersBlock) and title (Researchers) that come before the loop itself. What I need to do is set it up so that the div and title don't appear until a post has been added to that particular loop. This would be set up with conditionals, I just can't figure out how exactly to write it. Here is my current code:
<?php if (have_posts()) : ?>
<?php query_posts('category_name=researchers&showposts=50&order=ASC'); ?>
<div class="partnersBlock"><!--this should only appear if there are posts below-->
<h2>Researchers</h2><!--this should only appear if there are posts below-->
<?php while (have_posts()) : the_post(); ?>
<div class="largeProfile">
<div class="post" id="post-<?php the_ID(); ?>">
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
</div>
</div>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
</div><!--this should only appear if there are posts above-->
<?php endif; ?>
I'm building the functionality so the user can add posts when they're ready, but until that point no code is activated. As it stands this is printed:
<div class="partnersBlock">
<h2>Researchers</h2>
</div>
Any help is appreciated.