using line breaks in meta tags

﹥>﹥吖頭↗ 提交于 2019-12-13 18:42:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!