>  기사  >  백엔드 개발  >  출력 썸네일 주소

출력 썸네일 주소

巴扎黑
巴扎黑원래의
2016-11-09 13:46:55830검색

//输出缩略图地址
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;
}

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.