我使用标记:
<div class="owl-carousel-wrap photo-gallery ">
<div id="photoGallery" class="owl-carousel ">
<a href="#galleryPhotos" data-slide-to="0"><div class="item " data-toggle="modal" data-target="#photoGalleryModal">
<div class="photo-gallery_item"><img class="alignnone size-large wp-image-479" src="http://site/wp-content/uploads/2017/05/slide_6-comp-1024x683.jpg" alt="" /></div></div></a>
<a href="#galleryPhotos" data-slide-to="1"><div class="item " data-toggle="modal" data-target="#photoGalleryModal">
<div class="photo-gallery_item"><img class="alignnone size-large wp-image-480" src="http://site/wp-content/uploads/2017/05/slide_7-comp-1024x683.jpg" alt="" /></div></div></a>
<div>
</div>
当我将此代码粘贴到wp文本编辑器中时,它会删除标记
a
, 我有这个:
<div class="owl-carousel-wrap photo-gallery ">
<div id="photoGallery" class="owl-carousel ">
<div class="item " data-toggle="modal" data-target="#photoGalleryModal">
<div class="photo-gallery_item"><img class="alignnone size-large wp-image-479" src="http://site/wp-content/uploads/2017/05/slide_6-comp-1024x683.jpg" alt="" /></div>
</div>
<div class="item " data-toggle="modal" data-target="#photoGalleryModal">
<div class="photo-gallery_item"><img class="alignnone size-large wp-image-480" src="http://site/wp-content/uploads/2017/05/slide_7-comp-1024x683.jpg" alt="" /></div>
</div>
</div>
</div>
如何修复它?
最合适的回答,由SO网友:WebElaine 整理而成
WP正在删除以下内容data-slide-to="0\'
因为它认为它正在为您清理HTML。每当您有这样的自定义HTML时,请改用短代码。你碰巧很幸运-已经有plugin 这为您创建了短代码。
如果您不想使用插件,并且您已经在使用自定义主题或自定义子主题,那么可以查看插件中的代码,并在主题中构建类似的内容。