conditional inside loop
-
Hello,
The code I have below displays the last 20 posts made. I was wondering if its possible to isolate a specific post with a conditional to NOT have a link and only display the title.
<?php
$lastposts = get_posts('numberposts=20');
foreach($lastposts as $post) :
setup_postdata($post);
?>
<li>
<a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
ex. say i have 3 links
link1
link2
link3 <- not clickableSay im on the link3 post. Id want link1 and link2 to have the permalinks, but i dont want link 3 to be clickable.
Any help would be appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘conditional inside loop’ is closed to new replies.