public function widget($args, $instance) { $heading = trim($instance['list_name']); $communities = get_communities(); if (count($communities) > 0) { ?> <div class=""> <?php if (!empty($heading)) { ?> <h3 class="widget-title"><?php echo $heading; ?> </h3> <?php } else { ?> <h3 class="widget-title">Communities</h3> <?php } ?> <ul id="" class=""> <?php foreach ($communities as $community) { ?> <li id="" class=""> <a title="<?php echo $community->post_title; ?> " href="<?php echo get_permalink($community->ID); ?> "> <?php echo $community->post_title; ?> </a> </li> <?php } ?> </ul> </div><!-- /communities --> <?php } }
<?php get_header(); $listings = get_posts(array('post_type' => 'listing', 'numberposts' => 10, 'orderby' => 'post_date', 'order' => 'DSC', 'meta_query' => array(array('key' => 'listing_featured', 'value' => 'on')))); $communities = get_communities(); $count = 1; echo of_get_option('copyright'); ?> <div class="container row"> <!--start content --><div id="content" class="twelve columns"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoSlider"> <?php foreach ($listings as $listing) { ?> <?php $price_number = (double) get_post_meta($listing->ID, 'listing_asking_price', true); $price = '<span style="font-size: 18px;color:#777;padding-top:0px;margin-left:20px;">'; if (is_numeric($price_number)) { $price = $price . '$' . number_format($price_number, 0, '.', ',') . '</span>'; } else { $price = $price . '</span>'; } $image = get_the_post_thumbnail($listing->ID, 'nivo-slider', array('title' => $listing->post_title . $price)); if ($image) { echo '<a href=' . get_permalink($listing->ID) . '>' . $image . '</a>'; }