$catquery = new WP_Query( 'cat=2&posts_per_page=100&order=ASC' );
If have_posts {
while($catquery->have_posts()) : $catquery->the_post();
?>
<b><a href="http://artspacelansdowne.com/workshops/#<?php the_ID(); ?>"><?php the_title(); ?></a></b><?php the_meta(); ?>
<?php endwhile; ?>
else
echo "There are no Workshops at this time.";
}
I get this error…
Parse error: syntax error, unexpected T_STRING, expecting ‘(‘ in /home/content/12/9195112/html/asl/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 32
Is this the correct way to use this code?
<?php
$catquery = new WP_Query( 'cat=2&posts_per_page=100&order=ASC' );
If have_posts {
while($catquery->have_posts()) : $catquery->the_post();
?>
<b><a href="http://artspacelansdowne.com/workshops/#<?php the_ID(); ?>"><?php the_title(); ?></a></b><?php the_meta(); ?>
<?php endwhile; ?>
else
echo "There are no Workshops at this time.";
}
<?php endwhile; ?>
Sorry you need to make the if statement syntax right ..I just was giving you an idea how to do what you want to do.
http://codex.wordpress.org/Function_Reference/have_posts
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// Your loop code
endwhile;
else :
echo wpautop( 'Sorry, no posts were found' );
endif;
?>
based on the reply by @radices, but using your exact initial code:
<?php
$catquery = new WP_Query( 'cat=2&posts_per_page=100&order=ASC' );
if($catquery->have_posts()) :
while($catquery->have_posts()) : $catquery->the_post();
?>
<b><a href="http://artspacelansdowne.com/workshops/#<?php the_ID(); ?>"><?php the_title(); ?></a></b><?php the_meta(); ?>
<?php endwhile;
else:
echo wpautop( 'There are no Workshops at this time.' );
endif;
?>