WordPress:在缩略图中加载全尺寸图像 [英] WordPress: load full size image in thumbnail
本文介绍了WordPress:在缩略图中加载全尺寸图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于使用放大镜脚本,我需要在文章中加载完整图像(非特色图片),即使客户选择缩略图也是如此。
Because of using a magnifying glass script, I need to load the full image in the article (not featured image), even if the customer is choosing a thumbnail.
示例...应生成此代码:
Example... this code should be generated:
<img src="..../uploads/image.png" width="300" height="500" />
而不是
<img src="..../uploads/image-300x500.png" width="300" height="500" />
任何人都有一个很酷的片段吗?谢谢!
Anybody with a cool snippet for that? Thanks!
编辑:我指的是文章中使用的图片,而不是帖子/精选/缩略图图片功能。
I mean images that were used in the article, not the post/featured/thumbnail images-function.
推荐答案
这里是wordpress中自定义图像上传的代码
here is code for custom image upload in wordpress
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'your-custom-size' => __( 'Your Custom Size Name' ),
) );
}
// Assuming your Media Library image has a post id of 24...
echo wp_get_attachment_image( 24, 'your-custom-size' );
这篇关于WordPress:在缩略图中加载全尺寸图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文