Skip to content

Instantly share code, notes, and snippets.

@contempoinc
Created October 6, 2015 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save contempoinc/135c2d6051bbc8b48554 to your computer and use it in GitHub Desktop.
Save contempoinc/135c2d6051bbc8b48554 to your computer and use it in GitHub Desktop.
Single Listings for Automotive 2
<?php
/**
* Single Template
*
* @package WP Pro Automotive 2
* @subpackage Template
*/
global $ct_options;
get_header();
if (!empty($_GET['search-listings'])) {
require('search-listings.php');
return;
}
$cat = get_the_category();
$cat = $cat[0];
echo '<header id="archive-header" class="marB40">';
echo '<div class="container">';
echo '<div class="left">';
echo '<h2 class="marT0 marB0">';
echo __('Listings', 'contempo');
echo '</h2>';
echo '</div>';
echo ct_breadcrumbs();
echo '<div class="clear"></div>';
echo '</div>';
echo '</header>';
echo '<div class="container">';
if ( have_posts() ) : while ( have_posts() ) : the_post();
if($ct_options['ct_layout'] == 'left-sidebar') {
echo '<div id="sidebar" class="col span_3">';
if (function_exists('dynamic_sidebar') && dynamic_sidebar('Listing Single Left') ) :else: endif;
echo '</div>';
} ?>
<article class="col span_9 <?php if($ct_options['ct_layout'] == 'right-sidebar') { echo 'first'; } ?>">
<h4 id="sitename-for-print-only">
<?php bloginfo('name'); ?>
</h4>
<header class="listing-location">
<h2 class="marT5 marB0"><?php the_title(); ?></h2>
<p class="location marB0"><?php city(); ?>, <?php state(); ?> <?php zipcode(); ?></p>
</header>
<?php if( (get_post_meta($post->ID, "_ct_price", true)) != "" ) { ?><h3 class="price marT0 marB0"><?php currency(); ?><?php listing_price(); ?><?php if(has_status('for-rent') || has_status('rental')) { echo " /month"; } ?></h3><?php } ?>
<p class="propinfo marB0">
<i class="fa fa-automobile"></i>
<?php
echo '<span class="mileage">';
echo get_post_meta($post->ID, "_ct_mileage", true) . __(' miles', 'contempo');
echo '</span>';
?>
<?php if (function_exists('wpfp_link')) { ?><span class="save-this"><?php wpfp_link(); ?></span><?php } ?>
<a class="right" href="javascript:window.print()"><?php _e('Print this Listing', 'contempo'); ?></a>
</p>
<figure id="first-image-for-print-only">
<?php ct_first_image_lrg(); ?>
</figure>
<figure class="marB40">
<?php
$attachments = get_children(
array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => $post->ID
));
if(count($attachments) > 1) { ?>
<div id="slider" class="flexslider">
<?php ct_status(); ?>
<ul class="slides">
<?php ct_slider_images(); ?>
</ul>
</div>
<div id="carousel" class="flexslider">
<ul class="slides">
<?php ct_slider_carousel_images(); ?>
</ul>
</div>
<?php } else {
ct_first_image_lrg();
} ?>
</figure>
<?php get_template_part('includes/post-social'); ?>
<div class="col span_11 post-content">
<h4 class="border-bottom marT0 marB20"><?php _e('Primary Vehicle Information', 'contempo'); ?></h4>
<ul class="primary-info left marR30">
<?php if( (get_post_meta($post->ID, "_ct_stock", true)) != 0 ) { ?>
<li><strong><?php _e('Stock #', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_stock", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_price", true)) != 0 ) { ?>
<li><strong><?php _e('Price', 'contempo'); ?></strong> <span><?php currency(); ?><?php listing_price(); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_mileage", true)) != 0 ) { ?>
<li><strong><?php _e('Mileage', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_mileage", true); ?></span></li>
<?php } ?>
<?php
$extcolor = get_terms('extcolor');
if ( ! empty($extcolor)) { ?>
<li><strong><?php _e('Exterior Color', 'contempo'); ?></strong> <span><?php extcolor(); ?></span></li>
<?php }
?>
<?php
$intcolor = get_terms('intcolor');
if ( ! empty($intcolor)) { ?>
<li><strong><?php _e('Interior Color', 'contempo'); ?></strong> <span><?php intcolor(); ?></span></li>
<?php }
?>
<?php if( (get_post_meta($post->ID, "_ct_style", true)) != "" ) { ?>
<li><strong><?php _e('Body Style', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_style", true); ?></span></li>
<?php } ?>
</ul>
<ul class="primary-info left">
<?php if( (get_post_meta($post->ID, "_ct_engine", true)) != "" ) { ?>
<li><strong><?php _e('Engine', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_engine", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_trans", true)) != "" ) { ?>
<li><strong><?php _e('Transmission', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_trans", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_drive", true)) != "" ) { ?>
<li><strong><?php _e('Drive Type', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_drive", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_fuel", true)) != "" ) { ?>
<li><strong><?php _e('Fuel Type', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_fuel", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_doors", true)) != "" ) { ?>
<li><strong><?php _e('Doors', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_doors", true); ?></span></li>
<?php } ?>
<?php if( (get_post_meta($post->ID, "_ct_vin", true)) != "" ) { ?>
<li><strong><?php _e('Vin', 'contempo'); ?></strong> <span><?php echo get_post_meta($post->ID, "_ct_vin", true); ?></span></li>
<?php } ?>
</ul>
<div class="clear"></div>
<h4 class="border-bottom marB20"><?php _e('Vehicle Description', 'contempo'); ?></h4>
<?php the_content(); ?>
<?php addfeatlist(); ?>
<?php if(get_post_meta($post->ID, "_ct_video", true)) { ?>
<div class="videoplayer marB20">
<h4 class="border-bottom marB20"><?php _e('Video', 'contempo'); ?></h4>
<?php echo stripslashes(get_post_meta($post->ID, "_ct_video", true)); ?>
</div>
<?php } ?>
<?php if($ct_options['ct_disable_google_maps'] == 'No') { ?>
<div id="location">
<h4 class="border-bottom marB18"><?php _e('Location', 'contempo'); ?></h4>
<?php
$street_address = get_post_meta($post->ID, "_ct_street_address", true);
if($street_address != '') { ?>
<p>
<address>
<a target="_blank" href="http://maps.google.com/maps?q=<?php echo $street_address; ?>+<?php city(); ?>+<?php state(); ?>+<?php zipcode(); ?>">
<i class="fa fa-map-marker"></i>
<?php echo $street_address; ?>,
<?php city(); ?>, <?php state(); ?> <?php zipcode(); ?>
</a>
</address>
</p>
<?php } ?>
<?php listing_map(); ?>
</div>
<?php } ?>
</div>
<?php endwhile; endif; ?>
<div class="clear"></div>
<?php ct_post_nav(); ?>
<?php comments_template( '', true ); ?>
</article>
<?php if($ct_options['ct_layout'] == 'right-sidebar') {
echo '<div id="sidebar" class="col span_3">';
if (function_exists('dynamic_sidebar') && dynamic_sidebar('Listing Single Right') ) :else: endif;
echo '</div>';
}
echo '</div>';
get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment