dongtao4787 2015-09-09 04:30
浏览 46
已采纳

如何在wordpress中获取缩略图

I have code something like this,

$output .= '<div class="feature-course" '.$style.'>';
                $output .= '<h3><a href="' . get_permalink(). '">' . get_the_title(). '</a></h3>';      
                $output .= '<p>' . the_excerpt_max_charlength(70). '</p>';      
                $output .= '<a class="btn-featue" href="' . get_permalink(). '">' . __('View Course', 'themeum-lms'). ' <i class="fa fa-long-arrow-right"></i></a>';

I need to add image function how I can do that? Can you please suggest me.

  • 写回答

4条回答 默认 最新

  • drnpwmq4536 2015-09-09 06:37
    关注

    Try This

    $output .= '<div class="feature-course" '.$style.'>';
    $output .= '<h3><a href="' . get_permalink(). '">' . get_the_title(). '</a></h3>';  
    
    //Display Full image thubnail with link 
    $output .= '<a href="'.get_permalink().'">'.get_the_post_thumbnail(get_the_ID(),'full').'</a>';
    
    // Retrieve Thumbnail URL and use it on src attribute
    $output .= '<a href="'.get_permalink().'"><img src="'.wp_get_attachment_url(  get_post_thumbnail_id(get_the_ID()) ).'" alt="Yow" title="Yow" /></a>';
    
    $output .= '<p>' . the_excerpt_max_charlength(70). '</p>';      
    $output .= '<a class="btn-featue" href="' . get_permalink(). '">' . __('View Course', 'themeum-lms'). ' <i class="fa fa-long-arrow-right"></i></a>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部