问题
I want to use line breaks in my website description meta tag. How do I do it, because if I see the source code it will still show <br/>
only. Something like this I use in my code:
<meta name="description" content="<?php echo $gotAlias ?><br/>
abc: <?php echo $got_overallrating ?>.<br/>
<a href='www.abc.com'>Visit www.abc.com</a>
">
回答1:
Try "\n"
instead of <br />
, e.g. <?php echo "first line\nsecond line"; ?>
;
回答2:
For use in AddThis meta content tagging, the \n is ignored. So it doesn't work.
回答3:
//META TAGS
add_action( 'wp_head', 'tws_output_meta_tags', 5 );
function tws_output_meta_tags() {
echo '<meta name="author" content="content text" />'."\n";
}
来源:https://stackoverflow.com/questions/4694400/using-line-breaks-in-meta-tags