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.
You need to use
get_the_title()andget_the_date()instead. In WordPress, theget_*()versions of functions RETURN their data. Otherwise WP defaults to outputting the data instead.