在我的侧边栏小部件中,我试图将小部件内容包装在段落标记中:
$args = array(
'id' => 'applause-2',
'name' => 'Applause 2',
'description' => 'Main sidebar, below 1st horizontal rule',
'before_widget' => '<p>',
'after_widget' => '</p>'
);
但是当我检查输出时,看起来段落标记由于空格而自动关闭:
<p> <div class="textwidget">"Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Donec malesuada mauris dui, at auctor mauris tempor ac.
In hac habitasse platea dictumst. Vestibulum sed dolor velit." <a href="#" class="read-more">(read more)</a></div>
<img src="/wp-content/themes/italysource/img/hr.png" class="hr"></p> </div>
INSTEAD浏览器正在渲染:
<p></p>
<div class="textwidget">
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec malesuada mauris dui, at auctor mauris tempor ac. In hac habitasse platea dictumst. Vestibulum sed dolor velit." <a href="#" class="read-more">(read more)</a></div>
<img src="/wp-content/themes/italysource/img/hr.png" class="hr"> <p></p>
</div>
是否有解决方法,或者我可以采取哪些措施来防止这种情况发生?
答案 0 :(得分:2)
y
无效HTML。您无法将Returns:
the absolute URL of the current page
Gets the absolute URL of the current page.
放入<p><div></div></p>
内,并从各种浏览器中获得一致的结果。
在这个答案中更好地解释了这一点。 Putting <div> inside <p> is adding an extra <p>