Wordpress function tag coming outside the table
I have a table o开发者_运维百科f data in wordpress...
in the following code...
echo '<tr><td>Category</td><td>:</td><td>'. the_category(', ') .'</td></tr>';
category name is not displaying in correct position, it is displaying above all the row...
i can't figure out the problem... everything seems perfect...
Use get_the_category_list(', ')
. See documentation.
get_the_category_list()
returns the result, the_category()
prints the result
Well that is something that echo
will do with functions that print result you should use it like this
<?php // some code ?>
<tr><td>Category</td><td>:</td><td><?php the_category(', ') ?></td></tr>
<?php // some code ?>
Use functions in html.
精彩评论