【问题标题】:How to change the default image size for custom post type in WordPress如何在 WordPress 中更改自定义帖子类型的默认图像大小
【发布时间】:2017-01-09 06:34:39
【问题描述】:

当我们为特定帖子上传图片时,在管理面板中,该图片的默认大小为 medium (300 X 300)。而不是每次在插入帖子时从添加媒体>附件显示设置或插入帖子后从编辑>图像详细信息>显示设置更改它。我们如何将默认图像尺寸设置为完整/原始尺寸,或者如果它是完整尺寸则设置为中等/缩略图。

主要是更改默认图像大小设置。我该怎么做?

【问题讨论】:

  • 你想在前端帖子上全图显示吗?
  • 是的,但每次都不会从问题中提到的附件显示设置和显示设置中更改它。
  • the_post_thumbnail('full');你试过这个显示帖子图片的功能吗?

标签: wordpress


【解决方案1】:
function custom_image_size() {
    //set default for image size
    update_option('image_default_size', 'full' );
}
add_action('after_setup_theme', 'custom_image_size');

或者干脆

update_option('image_default_size', 'full' );

https://wordpress.stackexchange.com/questions/226915/how-to-set-the-default-embed-image-size

【讨论】:

    猜你喜欢
    • 2011-04-13
    • 1970-01-01
    • 2017-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多