kalponikoronno

Shortcode featured image

Jan 2nd, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. /**/
  2.  
  3. <img src="assets/images/works/p1.jpg" alt="">
  4. '.get_the_post_thumbnail($idd, 'slider-larger').'
  5. /**/
  6.  
  7. function aboutme_shortcode($atts, $content = null) {
  8.         extract(shortcode_atts(array(
  9.        
  10.         ), $atts));
  11.                
  12.                 $q = new WP_Query(
  13.                      array('posts_per_page' => '3', 'post_type' => 'profsingle')
  14.                 );
  15.                         $list .= '
  16.                        
  17.                         ';
  18.                                 while($q->have_posts()) : $q->the_post();
  19.                                 $image_id = get_post_thumbnail_id();  
  20.                                 $image_url = wp_get_attachment_image_src($image_id,'medium');  
  21.                                 $image_url = $image_url[0];
  22.                                     $list .= '
  23.                                                 <div class="col-md-4 aboutMe aboutStory wow fadeInUp" style="">        
  24.                                                 <h1 class="abtmetitle">'.get_the_title().'</h1>
  25.                                     ';
  26.                                    
  27.                                     if($image_url) :
  28.                                     $list .= '<img class="profileAv" alt="" src="'.$image_url.'"> ';   
  29.                                     endif;
  30.                                    
  31.                                     $list .= '                                 
  32.                                                     <p>'.get_the_content().'</p>   
  33.                                                 </div>                                                 
  34.                                                            
  35.                                             ';        
  36.        
  37.                                 endwhile;
  38.                         $list .= '
  39.                        
  40.                         ';
  41.                 wp_reset_query();
  42.                
  43.         return $list;
  44. }
  45. add_shortcode('aboutme', 'aboutme_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment