Advertisement
rexcoder

WP_Query

Jan 12th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.68 KB | None | 0 0
  1.     $marquee_loop = new WP_Query(
  2.         array(
  3.             'post_type' => 'marquee_panel',
  4.             'posts_per_page' => 10,
  5.             'post_status' => 'publish'
  6.         )
  7.     );
  8.    
  9.  
  10.     while ( $marquee_loop -> have_posts() ) : $marquee_loop -> the_post();
  11.         the_title('<h3>','</h3>');
  12.     endwhile;
  13.  
  14.  
  15. //--------------------------------------------------------------------------------------------------------------
  16.     echo '<div class="marquee">';
  17.         echo '<div class="marquee_data">';
  18.             while ( $marquee_loop -> have_posts() ) : $marquee_loop -> the_post();
  19.                 $image_id = get_post_thumbnail_id( $post_id );
  20.                 $image_url_full = wp_get_attachment_image_src($image_id,'full');
  21.                 $image_url_large = wp_get_attachment_image_src($image_id,'large');
  22.                 echo '<div class="marquee_panel" data-image-full="'.$image_url_full[0].'" data-image-large="'.$image_url_large[0].'">';
  23.                     echo '<div class="panel_caption">';
  24.                         the_title('<h3>','</h3>');
  25.                         echo '<div class="panel_content">';
  26.                             the_content();
  27.                         echo '</div>';
  28.                     echo '</div>';
  29.                 echo '</div>';
  30.             endwhile;
  31.         echo '</div>';
  32.     echo '</div>';
  33.  
  34.  
  35. //-----------------------------------------------------------------------------------------------------------------
  36. <!-- Markup of the above code -->
  37. <div class="marquee">
  38.     <div class="marquee_data">
  39.        
  40.         <div class="marquee_panel"
  41.             data-image-full="http://full-image-url.jpg"
  42.             data-image-large="http://large-image-url.jpg">
  43.  
  44.             <div class="panel_caption">
  45.                 <h3>this is title</h3>
  46.                 <div class="panel_content">
  47.                     <p>this is content</p>
  48.                     <a href="#"></a>
  49.                 </div>
  50.             </div>
  51.         </div>
  52.  
  53.     </div>
  54. </div>
  55. <!-- These are HTML5 attributes
  56. data-image-full=""
  57. data-image-large=""
  58. -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement