Advertisement
Guest User

Untitled

a guest
Apr 12th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.01 KB | None | 0 0
  1. <?php $my_query = "showposts=3"; $my_query = new WP_Query($my_query); ?>
  2. <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
  3.  
  4. <!-- standard tags to display blog post information like the_title() here -->
  5.  
  6. <?php endwhile; // end of one post ?>
  7. <?php endif; //end of loop ?>
  8.  
  9. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  10.  
  11. <!-- standard tags to display the static page information like the_title() here -->
  12.  
  13. <?php endwhile; endif; ?>
  14.  
  15. <?php
  16.  
  17. /* Template Name: Home Page */
  18.  
  19. global $shortname;
  20.  
  21. $theme_options = get_option( $shortname.'_theme_options' );
  22.  
  23. get_header();
  24.  
  25. ?>
  26.  
  27. <div id="wrapper">
  28.  
  29. <div id="top"></div> <!-- Anchor for top links -->
  30.  
  31. <div class="content-wrapper clearfix">
  32.  
  33. <?php get_template_part( 'navigation' ); ?>
  34.  
  35. <div class="col-780">
  36.  
  37. <?php if ( get_post_meta( $post->ID, $shortname.'_page_subtitle', true ) != '' ) { ?>
  38.  
  39. <div class="introduction">
  40.  
  41. <h2><?php echo get_post_meta( $post->ID, $shortname.'_page_subtitle', true ); ?></h2>
  42.  
  43. </div> <!-- /.introduction -->
  44.  
  45. <?php } ?>
  46.  
  47. <?php if ( get_post_meta( $post->ID, $shortname.'_home_slider', true ) == 'on' ) { ?>
  48.  
  49. <?php query_posts(
  50. array(
  51. 'post_type' => 'slider',
  52. 'posts_per_page' => 5
  53. )
  54. ); ?>
  55.  
  56. <?php if ( have_posts() ): ?>
  57.  
  58. <div id="slider" class="nivoSlider">
  59.  
  60. <?php while ( have_posts() ): the_post(); ?>
  61.  
  62. <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),'780x365' ); ?>
  63.  
  64. <a href="<?php echo get_post_meta( $post->ID, $shortname.'_slide_link', true ); ?>" title="<?php the_title(); ?>"><img src="<?php echo $src[0]; ?>" alt="" /></a>
  65.  
  66. <?php endwhile; ?>
  67.  
  68. </div> <!-- /#slider, .nivoSlider -->
  69.  
  70. <?php endif; ?>
  71.  
  72. <?php wp_reset_query(); ?>
  73.  
  74. <div class="hr thin"></div>
  75.  
  76. <?php } ?>
  77.  
  78. <?php if ( have_posts() ): ?>
  79.  
  80. <?php while ( have_posts() ): the_post(); ?>
  81.  
  82. <?php the_content(); ?>
  83.  
  84. <?php if( $post->post_content != "" ) { ?>
  85. <div class="hr thin"></div>
  86. <?php } ?>
  87.  
  88. <?php endwhile; ?>
  89.  
  90. <?php endif; ?>
  91.  
  92. <?php if ( get_post_meta( $post->ID, $shortname.'_home_portfolio', true ) == 'on' ) {
  93.  
  94. query_posts(
  95. array(
  96. 'post_type' => 'portfolio',
  97. 'taxonomy' => 'portfolio-categories',
  98. 'field' => 'slug',
  99. 'term' => get_post_meta( $post->ID, $shortname.'_portfolio_category', true ),
  100. 'orderby' => 'date',
  101. 'posts_per_page' => get_post_meta( $post->ID, $shortname.'_home_portfolio_limit', true )
  102. )
  103. );
  104.  
  105. if ( have_posts() ): ?>
  106.  
  107. <h5>Info</h5>
  108.  
  109. <ul id="portfolio-holder">
  110.  
  111. <?php while ( have_posts() ) : the_post(); ?>
  112.  
  113. <?php $post_categories = get_the_terms( $post->ID, 'portfolio-categories' );?>
  114. <?php $categories_list = NULL; ?>
  115.  
  116. <?php if ( $post_categories != NULL ) {
  117. foreach ( $post_categories as $category ) {
  118. $categories_list .= sanitize_title( $category->name ).' ';
  119. }
  120. } ?>
  121.  
  122. <li class="portfolio-item <?php echo $categories_list; ?>">
  123.  
  124. <?php // If set to open in lightbox...
  125. if ( get_post_meta( $post->ID, $shortname.'_open_lightbox', true ) == 'on' ) {
  126.  
  127. $set = rand( 0,99999 );
  128.  
  129. // Get lightbox items
  130. $args = array(
  131. 'post_type' => 'attachment',
  132. 'numberposts' => -1,
  133. 'post_status' => null,
  134. 'post_parent' => $post->ID,
  135. 'orderby' => 'menu_order',
  136. 'order' => 'ASC'
  137. );
  138.  
  139. $attachments = get_posts( $args );
  140.  
  141. if ( $attachments ) {
  142.  
  143. $isFirst = true;
  144.  
  145. // GALLERY ITEMS
  146. $gallery = '<div style="display:none;">';
  147.  
  148. // YouTube & Vimeo videos
  149. $videos = get_post_meta( $post->ID, $shortname.'_video_url', true );
  150.  
  151. if ( $videos != '' ) {
  152.  
  153. $videos_array = explode( ',', $videos );
  154.  
  155. foreach ( $videos_array as $video ) {
  156.  
  157. if ( $isFirst ) {
  158.  
  159. $first_url = $video;
  160. $isFirst = false;
  161. continue;
  162.  
  163. } else {
  164.  
  165. $gallery .= '<a href="'. $video .'" rel="prettyPhoto['.$set.']"></a>';
  166.  
  167. }
  168. }
  169.  
  170. }
  171.  
  172.  
  173. // Images
  174.  
  175. // This excludes is used to exclude the feature image
  176. // when the option is selected on the page edit screen.
  177. if ( get_post_meta( $post->ID, $shortname.'_exclude_feature_image_lightbox', true ) == 'on' ) {
  178. $feature_source = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'Full' );
  179. $featureurl = $feature_source[0];
  180. } else {
  181. $featureurl = '';
  182. }
  183.  
  184. foreach ( $attachments as $attachment ) {
  185.  
  186. $attachurl = wp_get_attachment_url( $attachment->ID );
  187.  
  188. if ( $attachurl != $featureurl ) {
  189.  
  190. if ( $isFirst ) {
  191.  
  192. $feature_description = $attachment->post_content;
  193. $first_url = $attachurl;
  194. $isFirst = false;
  195. continue;
  196.  
  197. } else {
  198.  
  199. $description = $attachment->post_content;
  200. $gallery .= '<a href="'. $attachurl .'" rel="prettyPhoto['.$set.']" title="'. $description .'"></a>';
  201.  
  202. }
  203.  
  204. }
  205.  
  206. }
  207.  
  208. $gallery .= '</div>';
  209.  
  210. } ?>
  211.  
  212. <a class="feature-image" href="<?php echo $first_url; ?>" rel="prettyPhoto[<?php echo $set; ?>]" title="<?php echo $feature_description; ?>">
  213. <?php the_post_thumbnail( 'thumbnail' ); ?>
  214. </a>
  215.  
  216. <?php // Output the gallery of items after first link so order is preserved.
  217. echo $gallery;
  218. unset( $gallery, $featureurl ); ?>
  219.  
  220. <?php } else { // If not set to open in lightbox output ususal permalink ?>
  221.  
  222. <a class="feature-image" href="<?php the_permalink(); ?>">
  223. <?php the_post_thumbnail( 'thumbnail' ); ?>
  224. </a>
  225.  
  226. <?php } ?>
  227.  
  228. <h3><?php the_title(); ?></h3>
  229.  
  230. <?php $excerpt = get_post_meta( $post->ID, $shortname.'_page_excerpt', true );
  231. if ( $excerpt != '' ) {
  232. echo '<p>'.$excerpt.'</p>';
  233. } else {
  234. raw_excerpt( 'excerptlength_blog', 'excerptmore' );
  235. } ?>
  236.  
  237. </li> <!-- /.portfolio-item -->
  238.  
  239. <?php endwhile; ?>
  240.  
  241. </ul> <!-- /#portfolio-holder -->
  242.  
  243. <div class="hr thin"></div>
  244.  
  245. <?php endif; ?>
  246.  
  247. <?php wp_reset_query(); ?>
  248.  
  249. <?php } ?>
  250.  
  251. <?php if ( get_post_meta( $post->ID, $shortname.'_home_blog', true ) == 'on' ) { ?>
  252.  
  253. <?php query_posts(
  254. array(
  255. 'post_type' => 'post',
  256. 'posts_per_page' => get_post_meta( $post->ID, $shortname.'_home_blog_limit', true )
  257. )
  258. );
  259.  
  260. if ( have_posts() ): ?>
  261.  
  262. <h5>LATEST NEWS</h5>
  263.  
  264. <div class="article-list page col-512">
  265.  
  266. <?php while ( have_posts() ): the_post(); ?>
  267.  
  268. <article class="col-675">
  269.  
  270. <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
  271. <?php if ( comments_open() ) { ?>
  272. <div class="comment-label"><?php comments_popup_link( '0', '1', '%' ); ?></div>
  273. <?php } ?>
  274.  
  275. <ul class="post-meta">
  276.  
  277. <?php if ( $theme_options[$shortname.'_enable_meta_date'] == 'true' ) { ?>
  278. <li>
  279. <strong>Posted on</strong>
  280. <time datetime="<?php the_time( 'c' );?>"><?php the_time( get_option( 'date_format' ) ); ?></time>
  281. </li>
  282. <?php } ?>
  283.  
  284. <?php if ( $theme_options[$shortname.'_enable_meta_author'] == 'true' ) { ?>
  285. <li>
  286. <strong>By</strong>
  287. <?php the_author(); ?>
  288. </li>
  289. <?php } ?>
  290.  
  291. <?php if ( $theme_options[$shortname.'_enable_meta_categories'] == 'true' ) { ?>
  292. <li class="category-meta">
  293. <strong>Posted in</strong>
  294. <?php the_category( ' ' ); ?>
  295. </li>
  296. <?php } ?>
  297.  
  298. <?php if ( $theme_options[$shortname.'_enable_meta_tags'] == 'true' ) { ?>
  299. <?php if ( has_tag() ) {?>
  300. <li class="tag-meta">
  301. <strong>Tagged</strong>
  302. <?php the_tags( '',' ' ); ?>
  303. </li>
  304. <?php } ?>
  305. <?php } ?>
  306.  
  307. </ul>
  308.  
  309. <div id="post-<?php the_ID(); ?>" <?php post_class( 'post-content' ); ?>>
  310.  
  311. <?php the_post_thumbnail( '512', array( 'class' => 'main-image' ) ); ?>
  312.  
  313. <?php raw_excerpt( 'excerptlength_blog', 'excerptmore' ); ?>
  314.  
  315. <a class="more-link" href="<?php the_permalink(); ?>">More &rarr;</a>
  316.  
  317. </div> <!-- /.post-content -->
  318.  
  319. </article>
  320.  
  321. <?php endwhile; ?>
  322.  
  323. </div> <!-- /.article-list, .page-->
  324.  
  325. <?php endif; ?>
  326.  
  327. <ul id="sidebar" class="col-246">
  328.  
  329. <?php if ( !function_exists( 'dynamic_sidebar' ) || !generated_dynamic_sidebar( __( 'Home Sidebar', 'raw_theme' ) ) ) { ?>
  330.  
  331. <?php } ?>
  332.  
  333. </ul> <!-- /#sidebar -->
  334.  
  335. <?php } ?>
  336.  
  337. </div> <!-- /.col-780 -->
  338.  
  339. </div> <!-- /.content-wrapper -->
  340.  
  341. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement