Echo inside a while loop
-
I am trying to do the following to get links to my pages. I am using this:
if ( have_posts() ) : while ( have_posts() ) : the_post(); echo '<li><a href="#">' . the_title() . '</a></li>'; endwhile; else: //echo 'Sorry, no pages matched your criteria.'; endif;
and this output this in my html:
Client Name<li><a href="#"></a></li>
yet, I want it to output this, like a proper link/li would look like:
<li><a href="#">Client Name</a></li>
Why is that happening and how can I fix this?
Thanks a lot for any help with this!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Echo inside a while loop’ is closed to new replies.