小编Tho*_*ier的帖子

更改为Wordpress图像插入的HTML

当您在页面或帖子中插入图像时,Wordpress通常会产生这种或类似的东西:

[caption id="attachment_IMAGEID" align="ALIGNMENT" width="WIDTH"]
<img src="IMAGEURL" alt="" width="WIDTH" height="HEIGHT" 
  class="size-SIZE wp-image-IMAGEID" />IMAGECAPTION
[/caption]
Run Code Online (Sandbox Code Playgroud)

哪个流程可以:

<div id="attachment_IMAGEID" style="width: WIDTH" class="wp-caption ALIGNMENT">
  <img src="IMAGEURL" alt="" width="WIDTH" height="HEIGHT" 
    class="size-SIZE wp-image-IMAGEID">
  <p class="wp-caption-text">IMAGE CAPTION</p>
</div>
Run Code Online (Sandbox Code Playgroud)

我想完全更改插入图像时创建的HTML.使用CSS完成大小调整,定位等.

这是理想情况下应该使用的HTML:

<figure class="figure img-small-left">
  <img src="IMAGEURL" />
  <figcaption class="figure-caption">
    IMAGECAPTION
  </figcaption>
</figure>
Run Code Online (Sandbox Code Playgroud)

如果它说img-small-left我想把CSS的类放在控制图像大小和位置的CSS上.这些是类:

img-small-right // small image, text wraps on the left
img-small-left // small image, text wraps on the right
img-medium // medium-sized image positioned in the center without wrap
img-medium-float // medium-sized image positioned left, …
Run Code Online (Sandbox Code Playgroud)

html wordpress image insert

5
推荐指数
1
解决办法
701
查看次数

标签 统计

html ×1

image ×1

insert ×1

wordpress ×1