custom loop question
-
Hey so I’m trying to learn the basics of custom loops, so I set up a single.php template in a childtheme of the sandbox theme, and I put the following code in it:
[please follow the forum guidelines for posting and marking code]
<?php get_header() ?>
<div id=”container”>
<div id=”content”>
<?php
$myPosts = new WP_Query();
$myPosts->query(’posts_per_page=1’);
while($myPosts->have_posts()) : $myPosts->the_post();
?><?php the_content();?>
<?php endwhile; ?>
<?php comments_template() ?></div><!– #content –>
</div><!– #container –><?php get_sidebar() ?>
<?php get_footer() ?>But whenever I run this on a single post I get an error saying:
Parse error: syntax error, unexpected ‘=’ in /home/a9394669/public_html/wp-content/themes/mytheme/single.php on line 7
Which doesn’t make any sense to me, because that’s part of the parameter. Can someone tell me what I’m doing wrong?
- The topic ‘custom loop question’ is closed to new replies.