wordpress - PHP text outside of li -
i building wordpress theme , reason list of pages showing outside li when view source
<ul class="tabs"> <?php while ( $queryobject->have_posts()) : $queryobject->the_post(); echo sprintf('<li>%s</li>', the_title()); endwhile; ?> </ul>
and when review source in inspector in chrome
<ul class="tabs"> deans’ corner<li></li> education plan<li></li> counselors’ corner<li></li> </ul>
i got missing simple
take @ docs the_title()
:
https://codex.wordpress.org/function_reference/the_title
displays or returns title of current post.
[...]
$echo
(boolean) (optional) display title (true) or return use in php (false).
default: true
the_title()
takes optional parameter $echo
decides whether should return or echo title of page. since did not fill , defaults echo option, code not work.
Comments
Post a Comment