doulu8341 2016-02-25 21:30
浏览 132
已采纳

删除“尺寸”属性 - wordpress

i'm just trying display image on my wordpress page from admin panel... and it works, but it generates me a lot of useless attributes... now its looks like this:

<img class="alignnone size-full wp-image-50" src="uploads/2016/02/moves.jpg" 
alt="moves" srcset="uploads/2016/02/moves-300x191.jpg 300w,
uploads/2016/02/moves.jpg 700w" sizes="(max-width: 700px) 100vw, 700px">

i need only this:

<img class="wp-image-50" src="uploads/2016/02/moves.jpg alt="moves">

How to fix it?

  • 写回答

1条回答 默认 最新

  • duandao8607 2016-02-25 21:38
    关注

    You can use wp_get_attachment_image_src example

     $src= wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, '' );
    

    in HTML

    <img src="<?php echo $src[0];?>" class="wp-image-50" alt="move" >
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)