Advertisement
sarahn

home.php

Dec 4th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.70 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Homepage
  4. **/
  5.  
  6. // calling the header.php
  7. get_header();
  8.  
  9. // action hook for placing content above #container
  10. thematic_abovecontainer();
  11. ?>
  12.  
  13. <div id="container">
  14.  
  15. <?php
  16. // action hook for inserting content above #content
  17. thematic_abovecontent();
  18.  
  19. // filter for manipulating the element that wraps the content
  20. echo apply_filters( 'thematic_open_id_content', '<div id="content">' . "\n\n" );
  21.  
  22. // calling the widget area 'page-top'
  23. get_sidebar('page-top');
  24.  
  25. // start the loop
  26. // WPMl Support
  27. //while ( have_posts() ) : the_post();
  28. the_post();
  29. //\ WPML Support
  30.  
  31. // action hook for inserting content above #post
  32. thematic_abovepost();
  33. ?>
  34.  
  35. <?php
  36. echo '<div id="post-' . get_the_ID() . '" ';
  37. // Checking for defined constant to enable Thematic's post classes
  38. if ( ! ( THEMATIC_COMPATIBLE_POST_CLASS ) ) {
  39. post_class();
  40. echo '>';
  41. } else {
  42. echo 'class="';
  43. thematic_post_class();
  44. echo '">';
  45. }
  46.  
  47. // creating the post header
  48. //thematic_postheader();
  49. ?>
  50.  
  51. <div class="entry-content">
  52.  
  53. <div class="home-left">
  54.  
  55. <?php
  56.  
  57. // The Content
  58.  
  59. echo '<div id="home-content">';
  60. the_content();
  61. echo '</div><!– /#home-content –>';
  62.  
  63. //wp_link_pages( "\t\t\t\t\t<div class='page-link'>" . __( 'Pages: ', 'thematic' ), "</div>\n", 'number' );
  64.  
  65. //edit_post_link( __( 'Edit', 'thematic' ), '<span class="edit-link">','</span>' );
  66.  
  67. ?>
  68.  
  69. <?php
  70.  
  71. // Homepage Infobox
  72.  
  73. /*
  74.  
  75. $homepage_infobox_image = get_post_meta( $post->ID, '_transcrip_home_infobox_image', true);
  76. $homepage_infobox_link = get_post_meta( $post->ID, '_transcrip_home_infobox_link', true);
  77.  
  78. if ( $homepage_infobox_image != '' ) {
  79.  
  80. echo '<div id="home-infobox">';
  81.  
  82. if ( $homepage_infobox_link != '' )
  83. echo '<a href="' . esc_url($homepage_infobox_link) . '">';
  84.  
  85. echo '<img id="homepage-infobox" src="' . esc_url($homepage_infobox_image) . '" />';
  86.  
  87. if ( $homepage_infobox_link != '' )
  88. echo '</a>';
  89.  
  90. echo '</div><!– /#home-infobox –>';
  91. }
  92. */
  93.  
  94. $facts_args = array(
  95. 'post_type' => 'facts',
  96. 'posts_per_page' => '-1', // show all
  97. 'order' => 'ASC',
  98. 'orderby' => 'rand'
  99. );
  100.  
  101. $facts_loop = new WP_Query($facts_args);
  102.  
  103. if ( $facts_loop->have_posts() ) :
  104.  
  105. $count = 0;
  106.  
  107. // start big facts
  108. echo '<div id="big-facts">';
  109.  
  110. while ( $facts_loop->have_posts() ) : $facts_loop->the_post();
  111.  
  112. $count++;
  113.  
  114. $facts_title = get_post_meta( $post->ID, '_transcrip_big_facts_title', true);
  115. $facts_image = get_post_meta( $post->ID, '_transcrip_big_facts_image', true);
  116. $facts_link = get_post_meta( $post->ID, '_transcrip_big_facts_link', true);
  117.  
  118. // if there's no image bail immediately
  119. if ( $facts_image != '' ) {
  120.  
  121. if ( $facts_link != '' )
  122. echo '<a href="' . esc_url($facts_link) . '" title="' . esc_attr($facts_title) . '">';
  123.  
  124. echo '<img id="big-facts-'. $count .'" src="' . esc_url($facts_image) . '" alt="' . esc_attr($facts_title) . '" />';
  125.  
  126. if ( $facts_link != '' )
  127. echo '<span class="arrow"></span>';
  128.  
  129. if ( $facts_link != '' )
  130. echo '</a>';
  131.  
  132. } // end facts_image check
  133.  
  134. endwhile;
  135.  
  136. // end big facts
  137. echo '</div><!– /#big-facts –>';
  138.  
  139. endif;
  140.  
  141. wp_reset_query();
  142.  
  143. ?>
  144.  
  145. </div><!– /.home-left –>
  146.  
  147. <div class="home-right">
  148.  
  149. <?php
  150.  
  151. // Box 1
  152.  
  153. $homepage_box_1_title = get_post_meta( $post->ID, '_transcrip_home_box_1_title', true);
  154. $homepage_box_1_content = get_post_meta( $post->ID, '_transcrip_home_box_1_content', true);
  155. $homepage_box_1_image = get_post_meta( $post->ID, '_transcrip_home_box_1_image', true);
  156. $homepage_box_1_colour = get_post_meta( $post->ID, '_transcrip_home_box_1_colour', true);
  157. $homepage_box_1_link = get_post_meta( $post->ID, '_transcrip_home_box_1_link', true);
  158.  
  159. if ( ( $homepage_box_1_title != '' ) || ( $homepage_box_1_content != '' ) || ( $homepage_box_1_image != '' ) ) {
  160.  
  161. echo '<div id="homepage-box-1">';
  162.  
  163. if ( $homepage_box_1_link != '' )
  164. echo '<a href="' . esc_url($homepage_box_1_link) . '">';
  165.  
  166. if ( $homepage_box_1_image != '' )
  167. echo '<img src="' . esc_attr( $homepage_box_1_image) . '" />';
  168.  
  169. if ( $homepage_box_1_colour != '' )
  170. echo '<div id="homepage-box-1-content" style="background: ' . esc_attr( $homepage_box_1_colour) . '">';
  171. else
  172. echo '<div id="homepage-box-1-content">';
  173.  
  174. if ( $homepage_box_1_title != '' )
  175. echo '<h3>' . esc_attr( $homepage_box_1_title) . '</h3>';
  176.  
  177. if ( $homepage_box_1_content != '' )
  178. echo wpautop( $homepage_box_1_content);
  179.  
  180. echo '</div><!– /#homepage-box-1-content –>';
  181.  
  182. if ( $homepage_box_1_link != '' )
  183. echo '<span class="arrow"></span>';
  184.  
  185. if ( $homepage_box_1_link != '' )
  186. echo '</a>';
  187.  
  188. echo '</div><!– /#homepage-box-1 –>';
  189.  
  190. }
  191.  
  192. ?>
  193.  
  194. <?php
  195.  
  196. // Box 2
  197.  
  198. $homepage_box_2_title = get_post_meta( $post->ID, '_transcrip_home_box_2_title', true);
  199. $homepage_box_2_content = get_post_meta( $post->ID, '_transcrip_home_box_2_content', true);
  200. $homepage_box_2_image = get_post_meta( $post->ID, '_transcrip_home_box_2_image', true);
  201. $homepage_box_2_colour = get_post_meta( $post->ID, '_transcrip_home_box_2_colour', true);
  202. $homepage_box_2_link = get_post_meta( $post->ID, '_transcrip_home_box_2_link', true);
  203.  
  204. if ( ( $homepage_box_2_title != '' ) || ( $homepage_box_2_content != '' ) || ( $homepage_box_2_image != '' ) ) {
  205.  
  206. if ( $homepage_box_2_colour != '' )
  207. echo '<div id="homepage-box-2" style="background: ' . esc_attr( $homepage_box_2_colour) . '">';
  208. else
  209. echo '<div id="homepage-box-2">';
  210.  
  211. if ( $homepage_box_2_link != '' )
  212. echo '<a href="' . esc_url($homepage_box_2_link) . '">';
  213.  
  214. if ( $homepage_box_2_image != '' )
  215. echo '<img src="' . esc_attr( $homepage_box_2_image) . '" />';
  216.  
  217. if ( $homepage_box_2_title != '' )
  218. echo '<h3>' . esc_attr( $homepage_box_2_title) . '</h3>';
  219.  
  220. if ( $homepage_box_2_content != '' )
  221. echo wpautop( $homepage_box_2_content);
  222.  
  223. if ( $homepage_box_2_link != '' )
  224. echo '</a>';
  225.  
  226. echo '</div><!– /#homepage-box-2–>';
  227.  
  228. }
  229.  
  230. ?>
  231.  
  232. <?php
  233.  
  234. // Box 3
  235.  
  236. $homepage_box_3_title = get_post_meta( $post->ID, '_transcrip_home_box_3_title', true);
  237. $homepage_box_3_content = get_post_meta( $post->ID, '_transcrip_home_box_3_content', true);
  238. $homepage_box_3_image = get_post_meta( $post->ID, '_transcrip_home_box_3_image', true);
  239. $homepage_box_3_colour = get_post_meta( $post->ID, '_transcrip_home_box_3_colour', true);
  240. $homepage_box_3_link = get_post_meta( $post->ID, '_transcrip_home_box_3_link', true);
  241.  
  242. if ( ( $homepage_box_3_title != '' ) || ( $homepage_box_3_content != '' ) || ( $homepage_box_3_image != '' ) ) {
  243.  
  244. if ( $homepage_box_3_colour != '' )
  245. echo '<div id="homepage-box-3" style="background: ' . esc_attr( $homepage_box_3_colour) . '">';
  246. else
  247. echo '<div id="homepage-box-3">';
  248.  
  249. if ( $homepage_box_3_link != '' )
  250. echo '<a href="' . esc_url($homepage_box_3_link) . '">';
  251.  
  252. if ( $homepage_box_3_image != '' )
  253. echo '<img src="' . esc_attr( $homepage_box_3_image) . '" />';
  254.  
  255. if ( $homepage_box_3_title != '' )
  256. echo '<h3>' . esc_attr( $homepage_box_3_title) . '</h3>';
  257.  
  258. if ( $homepage_box_3_content != '' )
  259. echo wpautop( $homepage_box_3_content);
  260.  
  261. if ( $homepage_box_3_link != '' )
  262. echo '</a>';
  263.  
  264. echo '</div><!– /#homepage-box-3–>';
  265.  
  266. }
  267.  
  268. ?>
  269.  
  270. <?php get_template_part('includes/clearfix'); ?>
  271.  
  272. </div><!– /.home-right –>
  273.  
  274. <?php get_template_part('includes/clearfix'); ?>
  275.  
  276. </div>
  277.  
  278. </div><!– .post –>
  279.  
  280. <?php
  281. // calls the do_action for inserting content below #post
  282. thematic_belowpost();
  283.  
  284. // action hook for calling the comments_template
  285. thematic_comments_template();
  286.  
  287. // end loop
  288. // WPMl Support
  289. //endwhile;
  290. //\WPML Support
  291.  
  292. // calling the widget area 'page-bottom'
  293. get_sidebar( 'page-bottom' );
  294. ?>
  295.  
  296. </div><!– #content –>
  297.  
  298. <?php
  299. // action hook for inserting content below #content
  300. thematic_belowcontent();
  301. ?>
  302. </div><!– #container –>
  303.  
  304. <?php
  305. // action hook for placing content below #container
  306. thematic_belowcontainer();
  307.  
  308. // calling footer.php
  309. get_footer();
  310. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement