This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

mom's headquarter

By: alchymyth on Jun 9th, 2011  |  syntax: PHP  |  size: 4.21 KB  |  views: 192  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php  
  2.  
  3. /* Template Name: Section */
  4.  
  5. get_header();  
  6.  
  7. global $qlan; include "languages/".$qlan.".php"; // load language file ##
  8. ?>
  9.  
  10. <div id="page">
  11.  
  12. <?php    
  13.  
  14.     if (have_posts()) : // post found ##
  15.  
  16. while (have_posts()) : the_post(); // start the_loop ##
  17.  
  18. // add breadcrumb & title ##
  19.  
  20. ?>
  21.  
  22. <div class="post" id="post-<?php the_ID(); ?>">
  23.  
  24. <?php
  25. if ( $ql_settings["breadcrumb"] == 1 ) : // show breadcrumb ##
  26. ?>
  27.  
  28. <div class="breadcrumb">
  29.  
  30. <ul>
  31.  
  32. <?php echo ql_breadcrumb(); ?>
  33.  
  34. </ul>
  35.  
  36. </div>
  37.  
  38. <?php
  39. endif ; // breadcrumb ##
  40. ?>
  41.  
  42. <h1>
  43.  
  44. <?php the_title(); ?>
  45.  
  46. </h1>
  47.  
  48. <div class="entry">
  49.  
  50. <?php the_content('Read more &raquo;'); ?>
  51.  
  52. </div>
  53.  
  54. <?php #include "page-share.php"; ?>
  55.  
  56. </div>
  57.  
  58. <?php  
  59.  
  60. endwhile; // the_loop ##
  61.  
  62. //initialize pagelist variable to hold list of pages to include
  63.  
  64. #$pagelist = "";
  65.  
  66. $section_list = array();
  67.  
  68.  
  69. // add any children of the current page to the list
  70.  
  71. $section_set = get_posts('post_type=page&numberposts=-1&post_parent='.$post->ID);
  72.  
  73. foreach ($section_set as $apage) {
  74.  
  75. $section_list[] = $apage->ID;
  76.  
  77. }
  78.  
  79. #var_dump($pagelist);
  80.  
  81. #s$pagelist = "1, 2";
  82.  
  83. // implode ID array at a comma, to a flat string ##
  84.  
  85. $section_ids_string = implode(",", $section_list);
  86.  
  87.  
  88.  
  89. // loop out home boxes ( all page IDs stored in array $pageids )##
  90.  
  91. $ql_query = "SELECT * FROM $wpdb->posts  
  92.  
  93.   WHERE ID in ( $section_ids_string ) && post_status = 'publish'
  94.  
  95.   ORDER by menu_order asc
  96.  
  97.   LIMIT 20";
  98.  
  99. #echo $ql_query;
  100.  
  101. $pageposts = $wpdb->get_results($ql_query, OBJECT);
  102.  
  103. // keep track ##
  104.  
  105. $counter = 1;  
  106.  
  107. if ( $pageposts ) : // found ##
  108.  
  109. ?>
  110.  
  111. <div id="section">
  112.  
  113. <?php
  114.  
  115. // test ##
  116.  
  117. #var_dump($ql_list_section);
  118.  
  119. $counter = 1; // initialize ##
  120.  
  121. // loop ##
  122.  
  123. foreach ( $pageposts as $post ) : // open ##
  124.  
  125. //setup post data for easy use  
  126.  
  127. setup_postdata($post);  
  128.  
  129. //I use this to skip the feature post in another loop  
  130.  
  131. $feature_post = $post->ID;  
  132.  
  133. if ( has_post_thumbnail( $post->ID ) ) :  
  134.  
  135. //Get the Thumbnail URL
  136.  
  137. #$domsxe = simplexml_load_string(get_the_post_thumbnail()); echo $domsxe;
  138.  
  139. #$thumbnailsrc = $domsxe->attributes()->src;
  140.  
  141. $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), array( 244, 177 ), false, '' ); //echo $src[0];
  142.  
  143. $thumbnailsrc = $src[0]; // take first array item ##
  144.  
  145. else : // no default_thumbnail ##
  146.  
  147. $thumbnailsrc = get_bloginfo('template_directory').'/images/home_default.jpg';
  148.  
  149. endif ; // check for default_thumbnail ##
  150.  
  151. // get parent title ##
  152.  
  153. #$parent_title = get_the_title($post->post_parent);
  154.  
  155. #$parent_link = get_permalink($post->post_parent);
  156.  
  157. if ( $counter == 1 ) :
  158. ?>
  159.  
  160. <div class="row">
  161.  
  162. <?php
  163. endif; // row ##
  164. ?>
  165.  
  166. <div class="box">
  167.  
  168. <!–<h3><a href="<?php echo $parent_link; ?>" title="<?php the_title_attribute(); ?>"><?php echo $parent_title; ?></a></h3>–>
  169.  
  170.  
  171.    <div class="icon">
  172.  
  173.     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
  174.  
  175.     <img src="<?php echo $thumbnailsrc; ?>" alt="<?php the_title(); ?>" />
  176.  
  177.     </a>
  178.  
  179.    </div><!--.icon-->  
  180.  
  181.    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>  
  182.  
  183.    <div class="text">
  184.  
  185.         <?php echo ql_excerpt_from_id( $feature_post, 120 ); // ?>
  186.  
  187.         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">Read More</a>
  188.  
  189.    </div><!--.text-->  
  190.  
  191. </div><!--.box-->
  192.  
  193. <?php
  194. // iterate ##
  195.  
  196. $counter++;
  197.  
  198. if ( $counter == 3 ) :
  199.  
  200. $counter = 1;
  201.  
  202. //close the .row div after an even number of box items
  203. ?>
  204.  
  205. </div><!--.row even-->
  206.  
  207. <?php
  208. endif; // counter ##
  209.  
  210. endforeach ; // end box loop ##
  211. ?>
  212.  
  213. <?php if($counter == 2) :
  214. //close the .row div if an odd number of box items was displayed ?>
  215. </div><!--.row odd-->
  216. <?php endif; ?>
  217.  
  218. </div><!--.section->
  219.  
  220. <?php
  221. endif ; // pages found ##
  222.  
  223. else : // nothing found ##
  224. ?>
  225.  
  226. <div class="post">
  227.  
  228. <div class="entry">
  229.  
  230. <p class="strong"><?php echo $qlan_news_nothing_title; ?></p>
  231.  
  232. <p><?php echo $qlan_news_nothing_text; ?></p>
  233.  
  234. </div>
  235.  
  236. </div>  
  237.  
  238. <?php
  239. endif; // found or not ##
  240. ?>
  241.  
  242. </div><!– eo #page –>
  243.  
  244. <?php
  245. get_sidebar(); // sidebar ##
  246. get_footer();
  247.  
  248.  
  249. ?>
clone this paste RAW Paste Data