开发者

Wordpress function tag coming outside the table

开发者 https://www.devze.com 2023-03-29 05:42 出处:网络
I have a table o开发者_运维百科f data in wordpress... in the following code... echo \'<tr><td>Category</td><td>:</td><td>\'. the_category(\', \') .\'</td>&l

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消