Loop question
-
I have a simple PHP script using WP APIs that is called not from a browser but from the command line, as:
php -f scriptname.php
It’s working, but something odd happens with the loop. I get the top 5 instances of the_title() and the_content_rss(), but I get the top 20 instances of the_permalink, as if the the_permalink is somehow not part of the same loop. Suggestions welcome, thanks.
<?php
query_posts(‘showposts=5’);
if ($posts) : foreach ($posts as $post) : start_wp();
the_title();
the_permalink();
the_content_rss(”, TRUE, ”, 100);
?>
———————–
<?php
endforeach; else:
_e(‘Sorry, no posts matched your criteria.’);
endif;
?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Loop question’ is closed to new replies.