Reputation: 4711
Trying to concat these PHP expressions into LI's but it's getting rendered as the php first and then the LI's...
function getVolArchives() {
query_posts('category_name=volunteerspotlights&showposts=5');
while (have_posts()) : the_post();
echo '<li>' . the_title() . '</li><li>' . the_date('F') . '</li>';
endwhile;
}
Obviously, it doesn't work like I thought it should...can I get some help?
What happens is that the TITLE and DATE show up and THEN two blank LI's... but the answer was already given to me below. I was using the wrong Wordpress functions.
Upvotes: 0
Views: 107
Reputation: 360702
You need to use get_the_title()
and get_the_date()
instead. In Wordpress, the get_*()
versions of functions RETURN their data. Otherwise WP defaults to outputting the data instead.
Upvotes: 4