Quick PHP Question
I’m not a PHP expert, but I can usually accomplish tasks by example.
I’m trying to use if/then logic AFTER this to display certain components of my sidebar on only some pages. My IF statement works fine if I place it above the following code, but it’s ignored by WordPress if I place it below the code. So I’m thinking that there’s something wrong with this code that disables if/then logic. The code came with my template and I didn’t modify it.
Anyone who is well-versed in PHP should see a glaring error here (if there is one):
<h2>Recently Posted</h2> <ul> <?php query_posts('showposts=10'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title() ?></a><span class="recent_date"><?php the_time('n.j') ?></span></li> <?php endwhile; endif; ?> </ul>
I think the problem might be with the “punctuation” (: vs. ;), but I really have no clue.
- The topic ‘Quick PHP Question’ is closed to new replies.