Output thumbnail address

巴扎黑
Release: 2023-03-03 12:08:01
Original
1405 people have browsed it

//输出缩略图地址 function post_thumbnail_src() { global $post; if ($values = get_post_custom_values("thumb")) { //输出自定义域图片地址 $values = get_post_custom_values("thumb"); $post_thumbnail_src = $values [0]; } elseif (has_post_thumbnail()) { //如果有特色缩略图,则输出缩略图地址 $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $post_thumbnail_src = $thumbnail_src [0]; } else { $post_thumbnail_src = ''; }; echo $post_thumbnail_src; }
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!