Created
October 30, 2015 15:37
-
-
Save contempoinc/9cd9983e3e57f50fea8f to your computer and use it in GitHub Desktop.
RE7 Featured Listings Random Order on Refresh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Testimonials | |
* | |
* @package WP Pro Real Estate 7 | |
* @subpackage Include | |
*/ | |
global $ct_options; | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
if(is_plugin_active('sitepress-multilingual-cms/sitepress.php')) { | |
$lang = ICL_LANGUAGE_CODE; | |
} | |
$ct_home_featured_num = isset( $ct_options['ct_home_featured_num'] ) ? $ct_options['ct_home_featured_num'] : ''; | |
$ct_home_featured_title = isset( $ct_options['ct_home_featured_title'] ) ? $ct_options['ct_home_featured_title'] : ''; | |
$ct_home_featured_btn = isset( $ct_options['ct_home_featured_btn'] ) ? $ct_options['ct_home_featured_btn'] : ''; | |
?> | |
<header class="masthead"> | |
<?php if(!empty($ct_home_featured_title)) { ?> | |
<h4 class="left marT0 marB0"><?php echo esc_html($ct_home_featured_title); ?></h4> | |
<?php } ?> | |
<?php if($ct_home_featured_btn == 'yes') { ?> | |
<?php if(is_plugin_active('sitepress-multilingual-cms/sitepress.php')) { ?> | |
<a class="view-all right" href="<?php echo home_url(); ?>?ct_ct_status=<?php echo strtolower(ct_get_taxo_translated()); ?>&search-listings=true<?php if($lang) { echo '?lang=' . $lang; } ?>"><?php esc_html_e('View All','contempo'); ?><i class="fa fa-angle-right"></i></a> | |
<?php } else { ?> | |
<a class="view-all right" href="<?php echo home_url(); ?>?ct_ct_status=featured&search-listings=true<?php if($lang) { echo '?lang=' . $lang; } ?>"><?php esc_html_e('View All','contempo'); ?><i class="fa fa-angle-right"></i></a> | |
<?php } ?> | |
<?php } ?> | |
<div class="clear"></div> | |
</header> | |
<ul> | |
<?php | |
if(is_plugin_active('sitepress-multilingual-cms/sitepress.php')) { | |
$args = array( | |
'ct_status' => ct_get_taxo_translated(), | |
'post_type' => 'listings', | |
'orderby' => 'rand', | |
'posts_per_page' => $ct_home_featured_num | |
); | |
} else { | |
$args = array( | |
'ct_status' => __('featured', 'contempo'), | |
'post_type' => 'listings', | |
'orderby' => 'rand', | |
'posts_per_page' => $ct_home_featured_num | |
); | |
} | |
$wp_query = new wp_query( $args ); | |
$count = 0; if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> | |
<li class="listing col span_4 <?php if($count % 3 == 0) { echo 'first'; } ?>"> | |
<figure> | |
<?php ct_status(); ?> | |
<?php ct_property_type_icon(); ?> | |
<?php if (function_exists('wpfp_link')) { ?><span class="save-this"><?php wpfp_link(); ?></span><?php } ?> | |
<?php ct_first_image_linked(); ?> | |
</figure> | |
<div class="grid-listing-info"> | |
<header> | |
<h5 class="marB0"><a href="<?php the_permalink(); ?>"><?php ct_listing_title(); ?></a></h5> | |
<p class="location muted marB0"><?php city(); ?>, <?php state(); ?> <?php zipcode(); ?></p> | |
</header> | |
<p class="price marB0"><?php ct_listing_price(); ?></p> | |
<div class="propinfo"> | |
<p><?php echo ct_excerpt(); ?></p> | |
<ul class="marB0"> | |
<?php ct_propinfo(); ?> | |
</ul> | |
</div> | |
</div> | |
</li> | |
<?php | |
$count++; | |
if($count % 3 == 0) { | |
echo '<div class="clear"></div>'; | |
} | |
endwhile; endif; wp_reset_postdata(); ?> | |
</ul> | |
<div class="clear"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment