<dl class='gallery-item'>
<dt class='gallery-icon'>
<a href='http://xxx.lt/wp-content/uploads/2013/02/snow-004.jpg' title='snow 004'><img width="200" height="81" src="http://xxx.lt/wp-content/uploads/2013/02/snow-004-200x81.jpg" class="attachment-thumbnail" alt="snow 004" /></a>
</dt>
</dl>
在wordpress中,我插入shartcode [gallery link="file" columns="3"]
,在使用W3C验证网站时,会收到错误Element dl is missing a required instance of child element dd
。这是一个wordpress错误?如何解决这个错误?也许在gallery_shortcode()
添加标记?
答案 0 :(得分:0)
答案是Wordpress使用dd作为图片标题,请参阅media.php中的代码。 为图库中的每个图片添加标题,然后通过css中的“display none”删除标题。
<div class="my_class">
<div class='gallery'>
<dl class='gallery-item'>
<dt class='gallery-icon landscape'>
<img width="190" height="190" src="XXXX" class="attachment-thumbnail" alt="X" />
</dt>
<dd class='wp-caption-text gallery-caption'>Some Caption</dd>
</dl>
</div>
</div>
CSS:
.my_class .wp-caption-text.gallery-caption{
display: none;
}
以防万一其他人正在寻找这个。 有点混乱,但它确实有效。
答案 1 :(得分:0)
我知道这个问题很旧,但是我刚才遇到了同样的问题,当搜索google时,这是显示的第一页。
html验证程序给我有关图库的错误,我可以通过将以下代码添加到functions.php中来修复它-
function Example() {
const [open, setOpen] = useState(false);
return (
<>
<Button
onClick={() => setOpen(!open)}
aria-controls="example-collapse-text"
aria-expanded={open}
>
click
</Button>
<Collapse in={open}>
<div id="example-collapse-text">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus
terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer
labore wes anderson cred nesciunt sapiente ea proident.
</div>
</Collapse>
<Button
onClick={() => setOpen(!open)}
aria-controls="example-collapse-text"
aria-expanded={open}
>
click
</Button>
<Collapse in={open}>
<div id="example-collapse-text">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus
terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer
labore wes anderson cred nesciunt sapiente ea proident.
</div>
</Collapse>
</>
);}