dongtao4787 2015-09-09 12: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 14: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条)

报告相同问题?

悬赏问题

  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了