Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $my_query = "showposts=3"; $my_query = new WP_Query($my_query); ?>
- <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <!-- standard tags to display blog post information like the_title() here -->
- <?php endwhile; // end of one post ?>
- <?php endif; //end of loop ?>
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <!-- standard tags to display the static page information like the_title() here -->
- <?php endwhile; endif; ?>
- <?php
- /* Template Name: Home Page */
- global $shortname;
- $theme_options = get_option( $shortname.'_theme_options' );
- get_header();
- ?>
- <div id="wrapper">
- <div id="top"></div> <!-- Anchor for top links -->
- <div class="content-wrapper clearfix">
- <?php get_template_part( 'navigation' ); ?>
- <div class="col-780">
- <?php if ( get_post_meta( $post->ID, $shortname.'_page_subtitle', true ) != '' ) { ?>
- <div class="introduction">
- <h2><?php echo get_post_meta( $post->ID, $shortname.'_page_subtitle', true ); ?></h2>
- </div> <!-- /.introduction -->
- <?php } ?>
- <?php if ( get_post_meta( $post->ID, $shortname.'_home_slider', true ) == 'on' ) { ?>
- <?php query_posts(
- array(
- 'post_type' => 'slider',
- 'posts_per_page' => 5
- )
- ); ?>
- <?php if ( have_posts() ): ?>
- <div id="slider" class="nivoSlider">
- <?php while ( have_posts() ): the_post(); ?>
- <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),'780x365' ); ?>
- <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>
- <?php endwhile; ?>
- </div> <!-- /#slider, .nivoSlider -->
- <?php endif; ?>
- <?php wp_reset_query(); ?>
- <div class="hr thin"></div>
- <?php } ?>
- <?php if ( have_posts() ): ?>
- <?php while ( have_posts() ): the_post(); ?>
- <?php the_content(); ?>
- <?php if( $post->post_content != "" ) { ?>
- <div class="hr thin"></div>
- <?php } ?>
- <?php endwhile; ?>
- <?php endif; ?>
- <?php if ( get_post_meta( $post->ID, $shortname.'_home_portfolio', true ) == 'on' ) {
- query_posts(
- array(
- 'post_type' => 'portfolio',
- 'taxonomy' => 'portfolio-categories',
- 'field' => 'slug',
- 'term' => get_post_meta( $post->ID, $shortname.'_portfolio_category', true ),
- 'orderby' => 'date',
- 'posts_per_page' => get_post_meta( $post->ID, $shortname.'_home_portfolio_limit', true )
- )
- );
- if ( have_posts() ): ?>
- <h5>Info</h5>
- <ul id="portfolio-holder">
- <?php while ( have_posts() ) : the_post(); ?>
- <?php $post_categories = get_the_terms( $post->ID, 'portfolio-categories' );?>
- <?php $categories_list = NULL; ?>
- <?php if ( $post_categories != NULL ) {
- foreach ( $post_categories as $category ) {
- $categories_list .= sanitize_title( $category->name ).' ';
- }
- } ?>
- <li class="portfolio-item <?php echo $categories_list; ?>">
- <?php // If set to open in lightbox...
- if ( get_post_meta( $post->ID, $shortname.'_open_lightbox', true ) == 'on' ) {
- $set = rand( 0,99999 );
- // Get lightbox items
- $args = array(
- 'post_type' => 'attachment',
- 'numberposts' => -1,
- 'post_status' => null,
- 'post_parent' => $post->ID,
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- $attachments = get_posts( $args );
- if ( $attachments ) {
- $isFirst = true;
- // GALLERY ITEMS
- $gallery = '<div style="display:none;">';
- // YouTube & Vimeo videos
- $videos = get_post_meta( $post->ID, $shortname.'_video_url', true );
- if ( $videos != '' ) {
- $videos_array = explode( ',', $videos );
- foreach ( $videos_array as $video ) {
- if ( $isFirst ) {
- $first_url = $video;
- $isFirst = false;
- continue;
- } else {
- $gallery .= '<a href="'. $video .'" rel="prettyPhoto['.$set.']"></a>';
- }
- }
- }
- // Images
- // This excludes is used to exclude the feature image
- // when the option is selected on the page edit screen.
- if ( get_post_meta( $post->ID, $shortname.'_exclude_feature_image_lightbox', true ) == 'on' ) {
- $feature_source = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'Full' );
- $featureurl = $feature_source[0];
- } else {
- $featureurl = '';
- }
- foreach ( $attachments as $attachment ) {
- $attachurl = wp_get_attachment_url( $attachment->ID );
- if ( $attachurl != $featureurl ) {
- if ( $isFirst ) {
- $feature_description = $attachment->post_content;
- $first_url = $attachurl;
- $isFirst = false;
- continue;
- } else {
- $description = $attachment->post_content;
- $gallery .= '<a href="'. $attachurl .'" rel="prettyPhoto['.$set.']" title="'. $description .'"></a>';
- }
- }
- }
- $gallery .= '</div>';
- } ?>
- <a class="feature-image" href="<?php echo $first_url; ?>" rel="prettyPhoto[<?php echo $set; ?>]" title="<?php echo $feature_description; ?>">
- <?php the_post_thumbnail( 'thumbnail' ); ?>
- </a>
- <?php // Output the gallery of items after first link so order is preserved.
- echo $gallery;
- unset( $gallery, $featureurl ); ?>
- <?php } else { // If not set to open in lightbox output ususal permalink ?>
- <a class="feature-image" href="<?php the_permalink(); ?>">
- <?php the_post_thumbnail( 'thumbnail' ); ?>
- </a>
- <?php } ?>
- <h3><?php the_title(); ?></h3>
- <?php $excerpt = get_post_meta( $post->ID, $shortname.'_page_excerpt', true );
- if ( $excerpt != '' ) {
- echo '<p>'.$excerpt.'</p>';
- } else {
- raw_excerpt( 'excerptlength_blog', 'excerptmore' );
- } ?>
- </li> <!-- /.portfolio-item -->
- <?php endwhile; ?>
- </ul> <!-- /#portfolio-holder -->
- <div class="hr thin"></div>
- <?php endif; ?>
- <?php wp_reset_query(); ?>
- <?php } ?>
- <?php if ( get_post_meta( $post->ID, $shortname.'_home_blog', true ) == 'on' ) { ?>
- <?php query_posts(
- array(
- 'post_type' => 'post',
- 'posts_per_page' => get_post_meta( $post->ID, $shortname.'_home_blog_limit', true )
- )
- );
- if ( have_posts() ): ?>
- <h5>LATEST NEWS</h5>
- <div class="article-list page col-512">
- <?php while ( have_posts() ): the_post(); ?>
- <article class="col-675">
- <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
- <?php if ( comments_open() ) { ?>
- <div class="comment-label"><?php comments_popup_link( '0', '1', '%' ); ?></div>
- <?php } ?>
- <ul class="post-meta">
- <?php if ( $theme_options[$shortname.'_enable_meta_date'] == 'true' ) { ?>
- <li>
- <strong>Posted on</strong>
- <time datetime="<?php the_time( 'c' );?>"><?php the_time( get_option( 'date_format' ) ); ?></time>
- </li>
- <?php } ?>
- <?php if ( $theme_options[$shortname.'_enable_meta_author'] == 'true' ) { ?>
- <li>
- <strong>By</strong>
- <?php the_author(); ?>
- </li>
- <?php } ?>
- <?php if ( $theme_options[$shortname.'_enable_meta_categories'] == 'true' ) { ?>
- <li class="category-meta">
- <strong>Posted in</strong>
- <?php the_category( ' ' ); ?>
- </li>
- <?php } ?>
- <?php if ( $theme_options[$shortname.'_enable_meta_tags'] == 'true' ) { ?>
- <?php if ( has_tag() ) {?>
- <li class="tag-meta">
- <strong>Tagged</strong>
- <?php the_tags( '',' ' ); ?>
- </li>
- <?php } ?>
- <?php } ?>
- </ul>
- <div id="post-<?php the_ID(); ?>" <?php post_class( 'post-content' ); ?>>
- <?php the_post_thumbnail( '512', array( 'class' => 'main-image' ) ); ?>
- <?php raw_excerpt( 'excerptlength_blog', 'excerptmore' ); ?>
- <a class="more-link" href="<?php the_permalink(); ?>">More →</a>
- </div> <!-- /.post-content -->
- </article>
- <?php endwhile; ?>
- </div> <!-- /.article-list, .page-->
- <?php endif; ?>
- <ul id="sidebar" class="col-246">
- <?php if ( !function_exists( 'dynamic_sidebar' ) || !generated_dynamic_sidebar( __( 'Home Sidebar', 'raw_theme' ) ) ) { ?>
- <?php } ?>
- </ul> <!-- /#sidebar -->
- <?php } ?>
- </div> <!-- /.col-780 -->
- </div> <!-- /.content-wrapper -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement