function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); if (empty($title)) { $title = false; } $agent = $instance['agent']; $sort_by = $instance['sort_by']; $count = intval($instance['count']); $featured = isset($instance['featured']) ? (bool) $instance['featured'] : false; $agent_args = array('post_type' => 'property', 'posts_per_page' => $count, 'meta_query' => array(array('key' => 'REAL_HOMES_agents', 'value' => $agent, 'compare' => '='))); // If show only Featured Properties if ($featured) { $agent_args['meta_query'][] = array('key' => 'REAL_HOMES_featured', 'value' => 1, 'compare' => '=', 'type' => 'NUMERIC'); } //Order by if ($sort_by == "random") { $agent_args['orderby'] = "rand"; } else { $agent_args['orderby'] = "date"; } $agent_query = new WP_Query($agent_args); echo $before_widget; if ($title) { echo $before_title; echo $title; echo $after_title; } if ($agent_query->have_posts()) { ?> <ul class="featured-properties"> <?php while ($agent_query->have_posts()) { $agent_query->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <figure> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('grid-view-image'); ?> </a> </figure> <?php } ?> <h4><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h4> <p><?php framework_excerpt(7); ?> <a href="<?php the_permalink(); ?> "><?php _e('Read More', 'framework'); ?> </a></p> <span class="price"><?php property_price(); ?> </span> </li> <?php } ?> </ul> <?php wp_reset_query(); } else { ?> <ul class="featured-properties"> <?php echo '<li>'; _e('No Property Found Under Selected Agent!', 'framework'); echo '</li>'; ?> </ul> <?php } echo $after_widget; }
"><?php the_title(); ?> </a></h4> <p><?php framework_excerpt(10); ?> <a class="more-details" href="<?php the_permalink(); ?> "><?php _e('More Details ', 'framework'); ?> <i class="fa fa-caret-right"></i></a></p> <span><?php property_price(); ?> </span> <div class="ajax-response"></div> </article> <?php } wp_reset_query(); } else { ?> <div class="alert-wrapper"> <h4><?php _e('No property found!', 'framework'); ?> </h4>
function property_custom_columns($column) { global $post; switch ($column) { case 'thumb': if (has_post_thumbnail($post->ID)) { ?> <a href="<?php the_permalink(); ?> " target="_blank"> <?php the_post_thumbnail('post-thumbnail'); ?> </a> <?php } else { _e('بدون مصغرات', 'framework'); } break; case 'id': $Prop_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if (!empty($Prop_id)) { echo $Prop_id; } else { _e('NA', 'framework'); } break; case 'city': echo get_the_term_list($post->ID, 'property-city', '', ', ', ''); break; case 'address': $address = get_post_meta($post->ID, 'REAL_HOMES_property_address', true); if (!empty($address)) { echo $address; } else { _e('No Address Provided!', 'framework'); } break; case 'type': echo get_the_term_list($post->ID, 'property-type', '', ', ', ''); break; case 'status': echo get_the_term_list($post->ID, 'property-status', '', ', ', ''); break; case 'price': property_price(); break; case 'bed': $bed = get_post_meta($post->ID, 'REAL_HOMES_property_bedrooms', true); if (!empty($bed)) { echo $bed; } else { _e('NA', 'framework'); } break; case 'bath': $bath = get_post_meta($post->ID, 'REAL_HOMES_property_bathrooms', true); if (!empty($bath)) { echo $bath; } else { _e('NA', 'framework'); } break; case 'garage': $garage = get_post_meta($post->ID, 'REAL_HOMES_property_garage', true); if (!empty($garage)) { echo $garage; } else { _e('NA', 'framework'); } break; case 'features': echo get_the_term_list($post->ID, 'property-feature', '', ', ', ''); break; } }