コード例 #1
0
ファイル: listing-title.php プロジェクト: phucanh92/vietlong
    function widget($args, $instance)
    {
        if (is_singular() && get_post_type() == wpsight_listing_post_type()) {
            extract($args, EXTR_SKIP);
            $title = apply_filters('widget_title', '[' . __('Listing Title', 'wpsight') . ']', $instance, $this->id_base);
            $title_listing = get_the_title(get_the_ID());
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-title section clearfix clear">
        		
				<div class="title clearfix">
					<h1 class="entry-title"><?php 
            echo apply_filters('wpsight_widget_listing_title', $title_listing, $args, $instance);
            ?>
</h1>
        	    	<?php 
            // Action hook listing title inside
            do_action('wpsight_listing_title_inside', $args, $instance);
            ?>
    	
        	    </div>
				
			</div><!-- .listing-title --><?php 
        }
    }
コード例 #2
0
    function widget($args, $instance)
    {
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            extract($args, EXTR_SKIP);
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            $unlink_features = isset($instance['unlink_features']) ? $instance['unlink_features'] : false;
            // Get features
            $listing_features_terms = get_the_terms(get_the_ID(), 'feature');
            // Stop here if no features
            if (empty($listing_features_terms)) {
                return;
            }
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-features section clearfix clear">
        		
				<?php 
            // Display title if exists
            if (!empty($title)) {
                ?>
						
						<div class="title clearfix">    
        	    	        <h2><?php 
                echo apply_filters('widget_title', $title, $instance, $this->id_base);
                ?>
</h2>
        	    	        <?php 
                // Action hook listing features title inside
                do_action('wpsight_listing_features_title_inside', $args, $instance);
                ?>
    	
        	    	    </div>
						
					<?php 
            }
            // Display features
            if (is_single() && get_post_type() == wpsight_listing_post_type() && !empty($listing_features_terms)) {
                $listing_features = '<ul class="clearfix">';
                foreach ($listing_features_terms as $term) {
                    // Optionally unlink features
                    if ($unlink_features) {
                        $listing_features .= '<li>' . $term->name . '</li>';
                    } else {
                        $listing_features .= '<li><a href="' . get_term_link($term, 'feature') . '">' . $term->name . '</a></li>';
                    }
                }
                $listing_features .= '</ul>';
                echo apply_filters('wpsight_widget_listing_features', $listing_features, $args, $instance);
            }
            ?>
				
			</div>
			
        <?php 
        }
    }
コード例 #3
0
    function widget($args, $instance)
    {
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            extract($args, EXTR_SKIP);
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            $margin = empty($title) ? ' style="margin-top:-10px"' : '';
            // Get description
            $listing = get_post(get_the_ID());
            $listing_description = apply_filters('the_content', $listing->post_content);
            if (empty($listing_description)) {
                return;
            }
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-description section clearfix clear"<?php 
            echo $margin;
            ?>
>
        		
				<?php 
            // Display title if exists
            if (!empty($title)) {
                ?>
						
						<div class="title clearfix">    
        	    	        <h2><?php 
                echo apply_filters('widget_title', $title, $instance, $this->id_base);
                ?>
</h2>
        	    	        <?php 
                // Action hook listing description title inside
                do_action('wpsight_listing_description_title_inside', $args, $instance);
                ?>
    	
        	    	    </div>
						
					<?php 
            }
            // Display content
            echo apply_filters('wpsight_widget_listing_description', $listing_description, $args, $instance);
            ?>
				
			</div>
			
        <?php 
        }
    }
コード例 #4
0
ファイル: listing-agent.php プロジェクト: phucanh92/vietlong
    function widget($args, $instance)
    {
        global $authordata;
        extract($args, EXTR_SKIP);
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            $title_name = isset($instance['title_name']) ? $instance['title_name'] : true;
            $title = $title_name ? '[' . __('Agent Name', 'wpsight') . ']' : strip_tags($instance['title']);
            $title_contact = isset($instance['title_contact']) ? $instance['title_contact'] : false;
            ?>
 
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-agent section clearfix clear">
			
				<?php 
            // Build widget title
            if ($title_name) {
                $title = get_the_author_meta('display_name');
            }
            // Display title if exists
            if (!empty($title)) {
                ?>
						
						<div class="title clearfix">
							<h2 class="author"><?php 
                echo apply_filters('widget_title', $title, $instance, $this->id_base);
                ?>
</h2>
        	    	        <?php 
                // Action hook listing agent title inside
                do_action('wpsight_listing_agent_title_inside', $args, $instance);
                ?>
    	
        	    	    </div><?php 
            }
            // Get author/listing agent information
            do_action('wpsight_listing_agent', 'listing', $args, $instance);
            ?>
 
			</div><!-- .listing-agent -->
			
		<?php 
        }
    }
コード例 #5
0
    function widget($args, $instance)
    {
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            $instance['email'] = isset($instance['email']) ? sanitize_email($instance['email']) : false;
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-contact section clearfix clear">
        	
        		<div id="contact">
        		
					<?php 
            // Display title if exists
            if (!empty($title)) {
                ?>
							
							<div class="title clearfix">    
        	    		        <h2><?php 
                echo apply_filters('widget_title', $title, $instance, $this->id_base);
                ?>
</h2>
        	    		        <?php 
                // Action hook listing contact title inside
                do_action('wpsight_listing_contact_title_inside', $args, $instance);
                ?>
    	
        	    		    </div><?php 
            }
            /**
             * Display contact form.
             * See code in /lib/framework/contact.php
             */
            do_action('wpsight_contact_form', 'listing', $instance, array('context' => 'widget', 'id' => $this->id));
            ?>
					
					</div><!-- #contact -->
				
			</div>
			
        <?php 
        }
    }
コード例 #6
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = isset($instance['title']) ? apply_filters('widget_title', strip_tags($instance['title']), $instance, $this->id_base) : false;
        $filter = isset($instance['filter']) ? strip_tags($instance['filter']) : false;
        $effect = isset($instance['effect']) ? $instance['effect'] : 'fade';
        $direction = isset($instance['direction']) ? $instance['direction'] : 'horizontal';
        $timer = isset($instance['timer']) ? (int) $instance['timer'] : 0;
        $prevnext = isset($instance['prevnext']) ? $instance['prevnext'] : true;
        $overlay = isset($instance['overlay']) ? $instance['overlay'] : true;
        $details = isset($instance['details']) ? $instance['details'] : true;
        $teaser = isset($instance['teaser']) ? $instance['teaser'] : true;
        $keynav = isset($instance['keynav']) ? $instance['keynav'] : true;
        $mousenav = isset($instance['mousenav']) ? $instance['mousenav'] : false;
        $random = isset($instance['random']) ? $instance['random'] : false;
        $unlink = isset($instance['unlink']) ? $instance['unlink'] : false;
        $number = isset($instance['number']) ? (int) $instance['number'] : 10;
        $length = isset($instance['length']) ? (int) $instance['length'] : 15;
        /**
         * Only show slider on first page
         * if blog template on front page
         */
        global $page;
        if (isset($page) && $page != 1) {
            return;
        }
        // Create query args
        if ($filter != 'custom') {
            $query_args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => $number);
            // Add filter to query args if required
            if (!empty($filter)) {
                if ($filter == 'latest-sale') {
                    // Set meta_query
                    $meta_query = array(array('key' => '_price_status', 'value' => 'sale'));
                    $query_args = array_merge($query_args, array('meta_query' => $meta_query));
                } elseif ($filter == 'latest-rent') {
                    // Set meta_query
                    $meta_query = array(array('key' => '_price_status', 'value' => 'rent'));
                    $query_args = array_merge($query_args, array('meta_query' => $meta_query));
                } elseif ($filter == 'latest-new') {
                    // Set meta_query
                    $meta_query = array(array('key' => '_price_status', 'value' => 'new'));
                    $query_args = array_merge($query_args, array('meta_query' => $meta_query));
                } elseif ($filter == 'latest-used') {
                    // Set meta_query
                    $meta_query = array(array('key' => '_price_status', 'value' => 'used'));
                    $query_args = array_merge($query_args, array('meta_query' => $meta_query));
                } else {
                    // Get taxonomy and term from filter (comma-separated value)
                    $get_taxonomy = explode(',', $filter);
                    $taxonomy = $get_taxonomy[0];
                    $term = $get_taxonomy[1];
                    // Set tax_query
                    $tax_query = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => array($term)));
                    $query_args = array_merge($query_args, array('tax_query' => $tax_query));
                }
            }
        } else {
            // If filter is custom, create meta query (slider => 1)
            $query_args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => $number, 'meta_query' => array(array('key' => 'slider', 'value' => '1')));
        }
        // Add random order to query args if required
        if ($random == true) {
            $query_args = array_merge($query_args, array('orderby' => 'random'));
        }
        $query_args = apply_filters('wpsight_widget_slider_query_args', $query_args, $args, $instance);
        // Check if transients are active
        $transients = apply_filters('wpsight_transients_queries', false, 'widget', $query_args, $this->id);
        // If query transients are active
        if ($transients === true) {
            // If transient does not exist
            if (false === ($slider = get_transient('wpsight_query_' . $this->id))) {
                // Create listing query
                $slider = new WP_Query($query_args);
                // Set transient for this query
                set_transient('wpsight_query_' . $this->id, $slider, DAY_IN_SECONDS);
            }
            // If query transients are not active
        } else {
            // Create listing query
            $slider = new WP_Query($query_args);
        }
        if ($slider->have_posts()) {
            // Create loop counter
            $counter = 1;
            // Set image size depending on widget area
            if ($id == 'home') {
                $image_size = 'big';
            } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-archive' || $id == 'sidebar-page' || $id == 'sidebar-post' || $id == wpsight_get_sidebar('sidebar-listing') || $id == wpsight_get_sidebar('sidebar-listing-archive')) {
                $image_size = 'post-thumbnail';
            } else {
                $image_size = 'full';
            }
            $image_size = apply_filters('wpsight_widget_listings_slider_image_size', $image_size, $args, $instance);
            // Create widget output
            ?>
			
			<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="widget widget-slider widget-listings-slider clearfix">
			
				<div class="widget-inner">
        	
        			<?php 
            // Display widget title
            if (!empty($title)) {
                ?>
							
						<div class="title title-widget clearfix">
					
						    <?php 
                echo apply_filters('wpsight_widget_listings_slider_title', '<h2>' . $title . '</h2>', $args, $instance);
                do_action('wpsight_widget_listings_slider_title_actions', $args, $instance);
                ?>
						
						</div><?php 
            }
            // endif $title
            // Convert boolean to strings for Javascript options
            $prevnext = $prevnext == true ? 'true' : 'false';
            $keynav = $keynav == true ? 'true' : 'false';
            $mousenav = $mousenav == true ? 'true' : 'false';
            $random = $random == true ? 'true' : 'false';
            // Correct timer and slideshow = true
            $slideshow = $timer == 0 ? 'false' : 'true';
            $slider_args = array('animation' => '"' . $effect . '",', 'direction' => '"' . $direction . '",', 'slideshow' => "{$slideshow},", 'slideshowSpeed' => "{$timer},", 'animationDuration' => '300,', 'directionNav' => "{$prevnext},", 'controlNav' => 'false,', 'keyboardNav' => "{$keynav},", 'mousewheel' => "{$mousenav},", 'prevText' => '"' . __('Previous', 'wpsight') . '",', 'nextText' => '"' . __('Next', 'wpsight') . '",', 'pausePlay' => 'false,', 'pauseText' => '"' . __('Pause', 'wpsight') . '",', 'playText' => '"' . __('Play', 'wpsight') . '",', 'randomize' => "{$random},", 'animationLoop' => 'true,', 'pauseOnAction' => 'true,', 'pauseOnHover' => 'true');
            $slider_args = apply_filters('wpsight_widget_listings_slider_options_args', $slider_args, $args, $instance);
            ?>
					
					<script type="text/javascript">
					jQuery(document).ready(function($){
					    $(function(){
					    	$('.flexslider').flexslider({
					    		<?php 
            foreach ($slider_args as $k => $v) {
                echo $k . ': ' . $v . "\n";
            }
            ?>
							});
					    });	            
					});
					</script>
					
					<?php 
            /**
             * Set fixed height on slider container
             * to avoid layout jump on load
             */
            $img = wpsight_get_image_size($image_size);
            $height = $img['size']['h'];
            ?>
        			
        			<div class="flexslider height-<?php 
            echo $height;
            ?>
">
        			
					  	<ul class="slides">
					  	
					  		<?php 
            // Loop through posts
            while ($slider->have_posts()) {
                $slider->the_post();
                // Check if slider_embed is active
                $slider_embed = get_post_meta(get_the_ID(), 'slider_embed', true);
                if (!empty($slider_embed)) {
                    echo '<li>' . wp_kses_post($slider_embed) . '</li>';
                } elseif (has_post_thumbnail()) {
                    ?>
					  				
					  				<li>
					  					<?php 
                    if ($unlink == false) {
                        echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), $image_size, array('alt' => get_the_title(), 'title' => get_the_title())) . '</a>';
                    } else {
                        echo get_the_post_thumbnail(get_the_ID(), $image_size, array('alt' => get_the_title(), 'title' => get_the_title()));
                    }
                    if ($overlay == true) {
                        ?>
					  						<div class="overlay<?php 
                        if ($teaser == false) {
                            echo ' no-teaser';
                        }
                        ?>
">
					  							<?php 
                        // Action hook to add content before overlay title
                        do_action('wpsight_widget_listings_slider_title_before', $args, $instance);
                        ?>
					  							<h3>
					  								<?php 
                        if ($unlink == false) {
                            echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
                        } else {
                            echo get_the_title();
                        }
                        ?>
					  							</h3>
					  							<?php 
                        // Action hook to add content after overlay title
                        do_action('wpsight_widget_listings_slider_title_after', $args, $instance);
                        if ($teaser == true) {
                            if ($unlink == false) {
                                wpsight_the_excerpt(get_the_ID(), true, $length);
                            } else {
                                echo wpsight_format_content(get_the_content(false));
                            }
                            // Action hook to add content after overlay teaser
                            do_action('wpsight_widget_listings_slider_teaser_after', $args, $instance);
                        }
                        ?>
					  						</div>
					  					<?php 
                    }
                    ?>
					  				</li>
					  				
					  				<?php 
                }
                // endif has_post_thumbnail()
            }
            // endwhile have_posts()
            ?>
					  	</ul>
					  	
					</div><!-- .flexslider -->
				
				</div><!-- .widget-inner -->
				
			</div><!-- .widget-slider --><?php 
        }
        // endif have_posts()
    }
コード例 #7
0
    function widget($args, $instance)
    {
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            extract($args, EXTR_SKIP);
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            $display = isset($instance['display']) ? $instance['display'] : 'thumbs';
            $effect = isset($instance['slider_effect']) ? $instance['slider_effect'] : 'fade';
            $timer = isset($instance['slider_timer']) ? (int) $instance['slider_timer'] : 0;
            $prevnext = isset($instance['slider_prevnext']) ? $instance['slider_prevnext'] : true;
            $links = isset($instance['gallery_links']) ? $instance['gallery_links'] : false;
            // Optional exclude
            $exclude_featured = isset($instance['exclude_featured']) ? $instance['exclude_featured'] : false;
            $exclude_images = isset($instance['exclude_images']) ? preg_replace(array('/[^\\d,]/', '/(?<=,),+/', '/^,+/', '/,+$/'), '', $instance['exclude_images']) : false;
            // Optional include
            $include_images = get_post_meta(get_the_ID(), 'gallery_include', true);
            $include = preg_replace(array('/[^\\d,]/', '/(?<=,),+/', '/^,+/', '/,+$/'), '', $include_images);
            // Create exclude
            $exclude = false;
            if ($exclude_featured) {
                $exclude = 'featured';
            }
            if ($exclude_images) {
                $exclude = $exclude_images;
            }
            // Create prevnext
            $prevnext = $prevnext ? 'true' : 'false';
            // Remove links
            $links = $links ? 'false' : 'true';
            $do_shortcode_args = array('exclude' => $exclude, 'include' => $include, 'effect' => $effect, 'timer' => $timer, 'prevnext' => $prevnext, 'link' => $links);
            // Correct size depending on widget area
            if ($args['id'] == wpsight_get_sidebar('sidebar-listing') || $args['id'] == 'sidebar') {
                $do_shortcode_args = array_merge(array('size' => 'small'), $do_shortcode_args);
            }
            $do_shortcode_args = apply_filters('wpsight_listing_gallery_shortcode_args', $do_shortcode_args, $args, $instance);
            // Set up $shortcode_args for shortcode
            $shortcode_args = '';
            foreach ($do_shortcode_args as $k => $v) {
                if ($do_shortcode_args[$k]) {
                    $shortcode_args .= ' ' . $k . '="' . $v . '"';
                }
            }
            // Reduce margin top if title empty
            $margin = empty($title) ? ' style="margin-top:-10px"' : '';
            // Create listing gallery
            $remove_links = isset($remove_links) ? $remove_links : false;
            $listing_gallery = '';
            if ($display == 'thumbs') {
                // Apply image_gallery shortcode
                $listing_gallery .= do_shortcode('[image_gallery' . $shortcode_args . $remove_links . ']');
            } else {
                // Apply image_slider shortcode
                $listing_gallery .= do_shortcode('[image_slider' . $shortcode_args . $remove_links . ']');
            }
            // Stop if no images
            if (empty($listing_gallery)) {
                return;
            }
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-gallery section clearfix clear"<?php 
            echo $margin;
            ?>
>
        		
				<?php 
            // Display title if exists
            if (!empty($title)) {
                ?>
						
						<div class="title clearfix">    
        	    	        <h2><?php 
                echo apply_filters('widget_title', $title, $instance, $this->id_base);
                ?>
</h2>
        	    	        <?php 
                // Action hook listing gallery title inside
                do_action('wpsight_listing_gallery_title_inside', $args, $instance);
                ?>
    	
        	    	    </div>
						
					<?php 
            }
            echo apply_filters('wpsight_widget_listing_gallery', $listing_gallery, $args, $instance);
            ?>
				    
		    </div><!-- .listing-gallery --><?php 
        }
    }
コード例 #8
0
ファイル: taxonomies.php プロジェクト: phucanh92/vietlong
function wpsight_restrict_manage_posts_detail()
{
    global $wpdb, $typenow;
    if ($typenow != wpsight_listing_post_type()) {
        return;
    }
    $standard_details = wpsight_standard_details();
    ?>

	<select name="wpsight-details">
		<option value=""><?php 
    _e('Listing Details', 'wpsight');
    ?>
</option><?php 
    $current = isset($_GET['wpsight-details']) ? $_GET['wpsight-details'] : false;
    $current_v = isset($_GET['wpsight-details-value']) ? $_GET['wpsight-details-value'] : false;
    foreach ($standard_details as $detail) {
        echo '<option value="' . $detail['id'] . '"' . selected($detail['id'], $current, false) . '>' . $detail['label'] . '</option>';
    }
    ?>

	</select>
	<input type="text" name="wpsight-details-value" size="8" value="<?php 
    echo $current_v;
    ?>
" style="margin-right:15px" /><?php 
}
コード例 #9
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
        $maptype = isset($instance['map_type']) ? $instance['map_type'] : 'ROADMAP';
        $mapzoom = isset($instance['map_zoom']) ? (int) $instance['map_zoom'] : 14;
        $streetview = isset($instance['streetview']) ? $instance['streetview'] : true;
        $map_args = array('control_type' => 'false', 'control_nav' => 'true', 'scrollwheel' => 'false', 'map_icon' => apply_filters('wpsight_map_listing_icon', WPSIGHT_ASSETS_IMG_URL . '/map-listing.png'), 'map_icon_w' => 24, 'map_icon_h' => 37, 'map_icon_x' => 12, 'map_icon_y' => 37, 'map_icon_shadow' => apply_filters('wpsight_map_listing_icon_shadow', WPSIGHT_ASSETS_IMG_URL . '/map-listing-shadow.png'), 'map_icon_shadow_w' => 24, 'map_icon_shadow_h' => 17, 'map_icon_shadow_x' => 12, 'map_icon_shadow_y' => 8);
        $map_args = apply_filters('wpsight_widget_listing_location_map_args', $map_args, $args, $instance);
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            // Get post custom data
            $custom = get_post_custom(get_the_ID());
            if (!isset($custom['_map_hide'][0]) || empty($custom['_map_hide'][0])) {
                // Get geo code
                if (!empty($custom['_map_geo'][0])) {
                    $marker = 'latLng:[' . $custom['_map_geo'][0] . ']';
                }
                // Get address
                if (!empty($custom['_map_address'][0])) {
                    $marker = 'address: "' . $custom['_map_address'][0] . '"';
                }
                // If new location value is available, use it
                if (!empty($custom['_map_location'][0])) {
                    $marker = 'latLng:[' . $custom['_map_location'][0] . ']';
                }
                if (!empty($marker)) {
                    ?>
				
					<div id="<?php 
                    echo wpsight_dashes($this->id);
                    ?>
" class="listing-location section clearfix clear">
						
						<?php 
                    $marker = 'marker:{ ' . $marker . ', options: { icon: ' . apply_filters('wpsight_map_listing_marker_icon', 'new google.maps.MarkerImage("' . $map_args['map_icon'] . '", new google.maps.Size(' . $map_args['map_icon_w'] . ', ' . $map_args['map_icon_h'] . '), new google.maps.Point(0, 0), new google.maps.Point(' . $map_args['map_icon_x'] . ', ' . $map_args['map_icon_y'] . '))', get_the_ID(), $map_args) . ', shadow: ' . apply_filters('wpsight_map_listing_marker_icon_shadow', 'new google.maps.MarkerImage("' . $map_args['map_icon_shadow'] . '", new google.maps.Size(' . $map_args['map_icon_shadow_w'] . ', ' . $map_args['map_icon_shadow_h'] . '), new google.maps.Point(0, 0), new google.maps.Point(' . $map_args['map_icon_shadow_x'] . ', ' . $map_args['map_icon_shadow_y'] . '))', get_the_ID(), $map_args) . ' } }';
                    $listing_location = '<script type="text/javascript">
								jQuery(document).ready(function($){
								    $(".listing-location-map").gmap3({
										' . $marker . ',
										map:{
										  options:{
									  	  	zoom: ' . $mapzoom . ',
									  	  	mapTypeId: google.maps.MapTypeId.' . $maptype . ',
										  	mapTypeControl: ' . $map_args['control_type'] . ',
										  	navigationControl: ' . $map_args['control_nav'] . ',
										  	scrollwheel: ' . $map_args['scrollwheel'] . ',
										  	streetViewControl: ' . $streetview . '
										  }
										}
									});	            
								});
							</script>';
                    // Display title if exists
                    if (!empty($title)) {
                        ?>
								
								<div class="title clearfix">    
					    	        <h2><?php 
                        echo apply_filters('widget_title', $title, $instance, $this->id_base);
                        ?>
</h2>
					    	        <?php 
                        // Action hook listing location title inside
                        do_action('wpsight_listing_location_title_inside', $args, $instance);
                        ?>
    	
					    	    </div>
								
							<?php 
                    }
                    $listing_location .= '<div class="listing-location-map"></div>';
                    if (!empty($custom['_map_note'][0])) {
                        $listing_location .= '<div class="listing-location-map-note alert clear">' . $custom['_map_note'][0] . '</div>';
                    }
                    echo apply_filters('wpsight_widget_listing_location', $listing_location, $args, $instance);
                    ?>
						
					</div><!-- .listing-location --><?php 
                }
                // endif ! empty( $marker )
            }
        }
    }
コード例 #10
0
ファイル: loop-author.php プロジェクト: phucanh92/vietlong
        $agent_image = '<img src="' . $author_image['url'] . '" class="avatar avatar-align-' . $image['align'] . '" />';
    } else {
        $agent_image = '<span class="avatar-align-' . $image['align'] . '">' . get_avatar(get_the_author_meta('email', $agent_id), '80') . '</span>';
    }
    if (!is_author()) {
        $listing_agent .= '<a href="' . get_author_posts_url($agent_id) . '" title="' . __('See my listings', 'wpsight') . '">';
    }
    $listing_agent .= $agent_image;
    if (!is_author()) {
        $listing_agent .= '</a>';
    }
}
// Put text next to image in extra div
$listing_agent .= '<div class="listing-agent-info">';
// Display agent name on agent list
if (!is_author() && (is_singular() && get_post_type() != wpsight_listing_post_type())) {
    $listing_agent .= '<h2>' . get_the_author_meta('display_name', $agent_id) . '</h2>';
}
// Get profile description/bio
if ($bio == true) {
    $listing_agent .= '<div class="listing-agent-bio">';
    $listing_agent .= apply_filters('the_content', get_the_author_meta('description', $agent_id));
    $listing_agent .= '</div><!-- .listing-agent-bio -->';
}
// Get profile contact email
if ($email['show'] == true) {
    $agent_email = get_the_author_meta('email', $agent_id);
    if (!empty($agent_email)) {
        $listing_agent .= '<div class="listing-agent-email">';
        if (!empty($email['icon'])) {
            $listing_agent .= $email['icon'];
コード例 #11
0
ファイル: page-tpl-map.php プロジェクト: phucanh92/vietlong
	    
	    	<?php 
// Don't show when password required
if (!post_password_required()) {
    // Save parent page ID
    $parent_id = get_the_ID();
    // Make sure paging works
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif (get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    // Set args for blog custom query
    $args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => apply_filters('wpsight_listings_map_nr', -1), 'paged' => $paged);
    // Exclude sold and rented
    $post_ids_sold_rented = $wpdb->get_col($wpdb->prepare("\n                \t    SELECT DISTINCT post_id FROM {$wpdb->postmeta}\n                \t    WHERE meta_key = '%s'\n                \t    AND meta_value = '%s'\n                \t", '_price_sold_rented', '1'));
    // Exclude from post options
    $post_ids_options = $wpdb->get_col($wpdb->prepare("\n                \t    SELECT DISTINCT post_id FROM {$wpdb->postmeta}\n                \t    WHERE meta_key = '%s'\n                \t    AND meta_value = '%s'\n                \t", '_map_exclude', '1'));
    // Merge arrays for exclude
    $post_ids_exclude = array_merge((array) $post_ids_sold_rented, (array) $post_ids_options);
    if (!empty($post_ids_exclude)) {
        $args = array_merge($args, array('post__not_in' => $post_ids_exclude));
    }
    $args = apply_filters('wpsight_map_query_args', $args);
    $map_query = new WP_Query($args);
    if ($map_query->have_posts()) {
        get_template_part('loop', 'map');
    } else {
        get_template_part('listing', 'no');
コード例 #12
0
	    
	    	<?php 
// Save parent page ID
$parent_id = get_the_ID();
// Make sure paging works
if (get_query_var('paged')) {
    $paged = get_query_var('paged');
} elseif (get_query_var('page')) {
    $paged = get_query_var('page');
} else {
    $paged = 1;
}
// Get listing IDs stored in cookie
$favorites = isset($_COOKIE[WPSIGHT_COOKIE_FAVORITES]) ? explode(',', $_COOKIE[WPSIGHT_COOKIE_FAVORITES]) : array($parent_id);
// Set args for blog custom query
$args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => 12, 'post__in' => $favorites, 'paged' => $paged);
// Set order args for global query
$order = array('orderby' => get_query_var('orderby'), 'order' => get_query_var('order'));
// Set orderby price if set
if (get_query_var('orderby') == 'price') {
    $order['orderby'] = 'meta_value_num';
    $order['meta_key'] = '_price';
}
// Merge order with args
$args = array_merge($args, $order);
$args = apply_filters('wpsight_listing_favorites_query_args', $args);
// Action hook to add content after archive title
do_action('wpsight_listing_archive_title_after', $args, $content_class);
$favorites_query = new WP_Query($args);
if ($favorites_query->have_posts()) {
    ?>
コード例 #13
0
ファイル: helpers.php プロジェクト: phucanh92/vietlong
function wpsight_manage_users_custom_column($value, $column_name, $user_id)
{
    if ($column_name != 'listings_count') {
        return $value;
    }
    $listings = new WP_Query(array('post_type' => wpsight_listing_post_type(), 'author' => $user_id));
    $listings_count = '<a href="edit.php?author=' . $user_id . '&post_type=' . wpsight_listing_post_type() . '">' . $listings->found_posts . '</a>';
    return $listings_count;
}
コード例 #14
0
ファイル: meta-boxes.php プロジェクト: phucanh92/vietlong
 function wpsight_listing_layout_options($option = '')
 {
     $layout_args = array('title' => __('Layout', 'wpsight'), 'post_types' => array(wpsight_listing_post_type()), 'sidebar_label' => __('Sidebar', 'wpsight'));
     $layout_args = apply_filters('wpsight_listing_layout_args', $layout_args);
     if (!empty($option)) {
         return $layout_args[$option];
     } else {
         return $layout_args;
     }
 }
コード例 #15
0
ファイル: _deprecated.php プロジェクト: phucanh92/vietlong
function wpsight_listing_image_overlay_comp($output)
{
    if (get_post_type() != wpsight_listing_post_type()) {
        return false;
    }
    return apply_filters('wpcasa_post_image_overlay', $output);
}
コード例 #16
0
ファイル: listings.php プロジェクト: phucanh92/vietlong
function wpsight_feed_request($qv)
{
    $feed_post_types = array('post', wpsight_listing_post_type());
    $feed_post_types = apply_filters('wpsight_feed_post_types', $feed_post_types);
    if (isset($qv['feed']) && !isset($qv['post_type'])) {
        $qv['post_type'] = $feed_post_types;
    }
    return $qv;
}
コード例 #17
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $listing_type = isset($instance['listing_type']) ? $instance['listing_type'] : true;
        $listing_location = isset($instance['listing_location']) ? $instance['listing_location'] : true;
        $listing_id = isset($instance['listing_id']) ? $instance['listing_id'] : true;
        // Loop through standard details
        foreach (wpsight_standard_details() as $key => $values) {
            $key = isset($instance[$key]) ? $instance[$key] : true;
        }
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-details section clearfix clear">
        	
        		<div class="title clearfix">
	        		
	        		<div class="title-price listing-price">
	        			<?php 
            wpsight_price();
            ?>
	        		</div>
	        		
	        		<?php 
            // Action hook listing details title inside
            do_action('wpsight_listing_details_title_inside', $args, $instance);
            ?>
						
				</div><!-- .title -->
				
				<?php 
            // Display details
            $standard_details = wpsight_standard_details();
            $listing_details = '';
            // Loop through standard details
            if (!empty($standard_details)) {
                $i = 0;
                $listing_details .= '<div class="row">' . "\n";
                foreach ($standard_details as $feature => $value) {
                    $standard_details_option = wpsight_get_option($feature);
                    // If details hasn't been set before, display default
                    if (!isset($standard_details_option['label'])) {
                        $standard_details_option = wpsight_get_option($feature, true);
                    }
                    // Don't show detail if label is emtpy in options
                    if (empty($standard_details_option['label'])) {
                        continue;
                    }
                    // Append listing ID to details
                    if ($i == 0 && $listing_id) {
                        $listing_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details_id .= '<span class="listing-details-label">' . __('Listing ID', 'wpsight') . ':</span>' . "\n";
                        $listing_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n";
                        $listing_details_id .= '</div><!-- .listing-details-id -->' . "\n";
                        $listing_details .= apply_filters('wpsight_listing_details_id', $listing_details_id, $args, $instance);
                    }
                    $listing_details_value = get_post_meta(get_the_ID(), '_' . $feature, true);
                    // Check if value is data key
                    if (!empty($value['data'])) {
                        $listing_details_value = $value['data'][$listing_details_value];
                    }
                    $listing_details_meta = get_post_meta(get_the_ID(), '_' . $feature, true);
                    if (!empty($listing_details_meta) && $instance[$feature]) {
                        $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n";
                        $listing_details .= '<span class="listing-details-value">' . $listing_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n";
                        $listing_details .= '</div><!-- .listing-' . $feature . ' -->' . "\n";
                    }
                    $i++;
                }
                // endforeach
                // Add date - will be hidden by CSS display:none
                $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                $listing_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n";
                $listing_details .= '</div>' . "\n";
                $listing_details .= '</div><!-- .row -->' . "\n";
            }
            // endif
            echo apply_filters('wpsight_widget_listing_details', $listing_details, $args, $instance);
            ?>
				
			</div><!-- .listing-details --><?php 
        }
    }
コード例 #18
0
ファイル: agents.php プロジェクト: phucanh92/vietlong
function wpsight_author_listings($query)
{
    if (is_admin()) {
        return;
    }
    if ($query->is_author || $query->is_search && !isset($_GET['stype'])) {
        $query->set('post_type', array(wpsight_listing_post_type()));
    }
}
コード例 #19
0
<?php

/**
 * The template for displaying search results archive pages.
 *
 * @package wpSight
 * @since 1.0
 */
global $counter, $wp_query;
// Check search term for listing ID
if (!empty($_GET['s'])) {
    $prefix = wpsight_get_option('listing_id');
    // Built ID search query
    $id_args = array('post_type' => wpsight_listing_post_type(), 'meta_query' => array('relation' => 'OR', array('key' => '_listing_id', 'value' => $_GET['s'], 'compare' => '='), array('key' => '_property_id', 'value' => $_GET['s'], 'compare' => '='), array('key' => '_listing_id', 'value' => $prefix . $_GET['s'], 'compare' => '='), array('key' => '_property_id', 'value' => $prefix . $_GET['s'], 'compare' => '=')));
    // Execute ID search query
    $id_query = new WP_Query($id_args);
    // If only one result, redirect to single listing page
    if ($id_query->post_count == 1) {
        // Get post ID of single search result
        $id_post = $id_query->posts[0]->ID;
        // Redirect to single listing page
        wp_redirect(get_permalink($id_post));
        exit;
    }
}
get_header();
?>

<div id="main-wrap" class="wrap">	

	<?php 
コード例 #20
0
ファイル: queries.php プロジェクト: phucanh92/vietlong
function wpsight_listing_archive_query($query)
{
    if (is_post_type_archive(array(wpsight_listing_post_type())) && $query->is_main_query() && !is_admin()) {
        // Get listing search query
        $args = wpsight_listing_archive_query_args();
        foreach ($args as $k => $v) {
            $query->set($k, $v);
        }
    }
    return $query;
}
コード例 #21
0
<div id="sidebar" class="<?php 
echo wpsight_get_span('small');
?>
"><?php 
do_action('wpsight_sidebar_listing_widgets_before');
if (is_singular() && get_post_type() == wpsight_listing_post_type() && !is_page_template('page-tpl-listings.php') && !is_page_template('page-tpl-properties.php') && !is_page_template('page-tpl-favorites.php') && !is_page_template('page-tpl-compare.php') && !is_page_template('page-tpl-map.php') && is_active_sidebar(wpsight_get_sidebar('sidebar-listing'))) {
    dynamic_sidebar(wpsight_get_sidebar('sidebar-listing'));
} else {
    dynamic_sidebar(wpsight_get_sidebar('sidebar-listing-archive'));
}
do_action('wpsight_sidebar_listing_widgets_after');
?>

</div><!-- #sidebar -->
コード例 #22
0
ファイル: main.php プロジェクト: phucanh92/vietlong
function wpsight_do_start_screen()
{
    // Activate welcome screen
    $welcome = apply_filters('wpsight_welcome_screen', true);
    if ($welcome == true) {
        ?>
	
		<div id="content" class="span12">
		
			<div id="welcome" class="post">
			
				<h1><?php 
        _e('Thank You!', 'wpsight');
        ?>
</h1>
			
				<p><?php 
        printf(__('Thank you very much for using the <strong>%1$s</strong> theme.', 'wpsight'), WPSIGHT_NAME);
        ?>
</p>
				
				<div class="row">
				
					<div class="span6">
				
						<h2 class="well" style="padding:5px 15px"><?php 
        _e('What Next?', 'wpsight');
        ?>
</h2>	    					
						<ul>	   					    
	   					    <li><?php 
        _e('Add some content', 'wpsight');
        ?>
 &rarr; <?php 
        printf(__('Create a new %1$s, %2$s or %3$s', 'wpsight'), '<a href="' . admin_url() . 'post-new.php">' . __('post', 'wpsight') . '</a>', '<a href="' . admin_url() . 'post-new.php?post_type=page">' . __('page', 'wpsight') . '</a>', '<a href="' . admin_url() . 'post-new.php?post_type=' . wpsight_listing_post_type() . '">' . __('listing', 'wpsight') . '</a>');
        ?>
</li>	    				    
	   					    <li><?php 
        _e('Make your settings in the theme options', 'wpsight');
        ?>
 &rarr; <a href="<?php 
        echo admin_url();
        ?>
admin.php?page=<?php 
        echo WPSIGHT_DOMAIN;
        ?>
"><?php 
        _e('Theme options', 'wpsight');
        ?>
</a></li>	   					    
	   					    <li><?php 
        _e('Drag widgets to the home page widget area', 'wpsight');
        ?>
 &rarr; <a href="<?php 
        echo admin_url();
        ?>
widgets.php"><?php 
        _e('Edit widgets', 'wpsight');
        ?>
</a></li>	   					    
	   					    <li><?php 
        _e('Add items to the main menu', 'wpsight');
        ?>
 &rarr; <a href="<?php 
        echo admin_url();
        ?>
nav-menus.php"><?php 
        _e('Create a custom menu', 'wpsight');
        ?>
</a></li>	   					
	   					</ul>	   					
	   				</div>
	   				
	   				<div class="span6">	   				
	   					<h2 class="well" style="padding:5px 15px"><?php 
        _e('Example Content?', 'wpsight');
        ?>
</h2>	    		
						<p><?php 
        _e('To get started with the theme you may also want to upload some dummy content (also see <a href="http://codex.wordpress.org/Importing_Content#WordPress" target="_blank">codex</a> about importing content)', 'wpsight');
        ?>
</p>						
						<p><a href="http://wpcasa.com/download/<?php 
        echo apply_filters('wpsight_example_xml_name', WPSIGHT_DOMAIN);
        ?>
.xml" class="btn btn-success btn-mini"><?php 
        _e('Download XML', 'wpsight');
        ?>
</a></p>	   				
	   				</div>
	   			
	   			</div><!-- .row -->
	   			
	   			<h2><?php 
        _e('Need Help?', 'wpsight');
        ?>
</h2>	   			
	   			<p><?php 
        _e('If you need any help, please head over to the <a href="http://wpcasa.com/support/" target="_blank">support center</a>.', 'wpsight');
        ?>
</p>
			
			</div><!-- #welcome -->
		
		</div><!-- #content --><?php 
    } else {
        // When welcome is false show latest posts
        // Set args for home custom query
        $home_query_args = array('posts_per_page' => get_option('posts_per_page'), 'paged' => get_query_var('paged'));
        $home_query_args = apply_filters('wpsight_home_query_args', $home_query_args);
        $home_query = new WP_Query($home_query_args);
        if ($home_query->have_posts()) {
            // Set class of #content div on home depending on active sidebars
            $content_class = is_home() && (is_active_sidebar('sidebar') || is_active_sidebar('sidebar-archive')) ? wpsight_get_span('big') : wpsight_get_span('full');
            ?>
	    	    
	    	<div id="content" class="<?php 
            echo $content_class;
            ?>
">
									
		    	<div class="row">
		    	
		    		<?php 
            // Create loop counter
            global $counter;
            $counter = 0;
            while ($home_query->have_posts()) {
                // Increase loop counter
                $counter++;
                $home_query->the_post();
                /* Include the Post-Format-specific template for the content.
                 * If you want to overload this in a child theme then include a file
                 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                 */
                get_template_part('loop', get_post_format());
            }
            // endwhile have_posts()
            ?>
		    	
		    	</div><!-- .row --><?php 
            wpsight_pagination($home_query->max_num_pages);
            ?>
		    
		    </div><!-- #content --><?php 
            get_sidebar();
        } else {
            get_template_part('loop', 'no');
        }
        // endif have_posts()
    }
    // endif $welcome
}