Ejemplo n.º 1
0
    function widget($args, $instance)
    {
        if (is_single() && get_post_type() == 'property') {
            extract($args, EXTR_SKIP);
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            $margin = empty($title) ? ' style="margin-top:-10px"' : '';
            // Get description
            $property = get_post(get_the_ID());
            $property_description = wpsight_format_content($property->post_content);
            if (empty($property_description)) {
                return;
            }
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($args['widget_id']);
            ?>
" class="property-description listing-description section clearfix clear"<?php 
            echo $margin;
            ?>
>
        		
				<?php 
            // Display title if exists
            if (!empty($title)) {
                ?>
						
						<div class="title clearfix">    
        	    	        <h2><?php 
                echo $title;
                ?>
</h2>
        	    	        <?php 
                // Action hook property description title inside
                do_action('wpsight_listing_description_title_inside', $args, $instance);
                ?>
    	
        	    	    </div>
						
					<?php 
            }
            // Display content
            echo apply_filters('wpsight_widget_listing_description', $property_description);
            ?>
				
			</div>
			
        <?php 
        }
    }
Ejemplo n.º 2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        // Only on posts and pages
        if (!is_singular()) {
            return;
        }
        $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
        $space = isset($instance['space']) ? $instance['space'] : false;
        // Get custom field
        $space_content = get_post_meta(get_the_ID(), $space, true);
        // Stop if it has no value
        if (empty($space_content)) {
            return;
        }
        ?>
        
		<div id="<?php 
        echo wpsight_dashes($this->id);
        ?>
-wrap" class="widget-wrap widget-post-spaces-wrap">
		
		    <div id="<?php 
        echo wpsight_dashes($this->id);
        ?>
" class="widget section widget-post-spaces clearfix">
		    
		    	<div class="widget-inner"><?php 
        if (!empty($title)) {
            echo '<h3 class="title">' . apply_filters('widget_title', $title, $instance, $this->id_base) . '</h3>';
        }
        echo wpsight_format_content($space_content);
        ?>
		
		    	</div><!-- .widget-inner -->
		    	
		    </div><!-- .widget -->
		    
		</div><!-- widget-wrap --><?php 
    }
Ejemplo n.º 3
0
?>
">
	    
	    	<?php 
if (have_posts()) {
    ?>
	    
				<div class="title title-archive clearfix">
				
				    <?php 
    echo apply_filters('wpsight_category_title', '<h1>' . single_cat_title('', false) . '</h1>');
    // Action hook to add content to title
    do_action('wpsight_loop_title_actions');
    // Display category description
    if (category_description()) {
        echo '<div class="category-description clearfix">' . wpsight_format_content(category_description()) . '</div>';
    }
    ?>
				
				</div><!-- .title --><?php 
    // Action hook to add content after archive title
    do_action('wpsight_archive_title_after', $content_class);
    ?>
				
				<div class="row">
	    		
	    			<?php 
    // Create loop counter
    $counter = 0;
    while (have_posts()) {
        // Increase loop counter
Ejemplo n.º 4
0
the_post();
?>
	    
			<div class="title title-archive clearfix">
			
				<h1><?php 
the_title();
?>
</h1>
			
			    <?php 
// Action hook to add content to title
do_action('wpsight_loop_title_actions');
// Display post content like category description
if (!empty($post->post_content) && !post_password_required()) {
    echo '<div class="category-description clearfix">' . wpsight_format_content($post->post_content) . '</div>';
}
?>
			
			</div><!-- .title -->
	    
	    	<?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');
Ejemplo n.º 5
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()
    }
Ejemplo n.º 6
0
function wpsight_listing_description_shortcode($atts)
{
    $defaults = array('id' => get_the_ID(), 'before' => '', 'after' => '', 'filter' => 'the_content', 'wrap' => 'div');
    extract(shortcode_atts($defaults, $atts));
    // Get post object
    $listing = get_post($id);
    // Get description
    $description = $listing->post_content;
    // Stop if no description
    if (empty($description)) {
        return;
    }
    // Apply filter
    if (!empty($filter) && $filter != 'false') {
        $description = apply_filters($filter, $description);
    }
    // Apply filter
    if ($filter === true) {
        $description = wpsight_format_content($description);
    }
    $output = sprintf('%1$s%3$s%2$s', $before, $after, $description);
    // Optionally wrap shortcode in HTML tags
    if (!empty($wrap) && $wrap != 'false' && in_array($wrap, array_keys(wp_kses_allowed_html('post')))) {
        $output = sprintf('<%2$s class="listing-description-sc">%1$s</%2$s>', $output, $wrap);
    }
    return apply_filters('wpsight_listing_description_shortcode', $output, $atts);
}
Ejemplo n.º 7
0
function wpsight_do_listing_agent($location = false, $widget = false, $instance = false)
{
    /**
     * Check location and set
     * $args accordingly
     */
    if ($location == 'archive') {
        // Set agent ID
        $agent = get_userdata(get_query_var('author'));
        $agent_id = $agent->ID;
        // Set contact link
        $contact_link = is_pagetemplate_active('page-tpl-contact.php') ? add_query_arg(array(apply_filters('wpsight_author_slug', 'agent') => $agent_id), get_pagetemplate_permalink('page-tpl-contact.php')) : false;
        // Set $args
        $args = array('title' => $agent->display_name, 'contact' => esc_url($contact_link), 'image' => array('show' => true, 'align' => 'right', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => false);
        $args = apply_filters('wpsight_listing_agent_info_args_archive', $args, $agent_id);
    } elseif ($location == 'listing') {
        // Set agent ID
        $agent_id = get_the_author_meta('ID');
        // Set $args
        $args = array('title' => get_the_author(), 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true);
        $args = apply_filters('wpsight_listing_agent_info_args_listing', $args, $widget, $instance, $agent_id);
    } elseif ($location == 'featured') {
        // Set agent ID
        $agent_id = $instance['agent'];
        // Set $args
        $args = array('title' => false, 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true);
        $args = apply_filters('wpsight_listing_agent_info_args_featured', $args, $widget, $instance, $agent_id);
    } elseif ($location == 'list') {
        // Set agent ID
        global $agent_id;
        // Set $args
        $args = array('title' => true, 'image' => array('show' => true, 'align' => 'left', 'linked' => true), 'bio' => true, 'email' => array('show' => true, 'icon' => '<i class="icon-envelope"></i> ', 'linked' => true), 'url' => array('show' => true, 'icon' => '<i class="icon-external-link"></i> ', 'linked' => true), 'custom' => array('fields' => wpsight_profile_contact_fields($location), 'icon' => true, 'linked' => true), 'button' => true);
        $args = apply_filters('wpsight_listing_agent_info_args_list', $args, $agent_id);
    }
    $args = apply_filters('wpsight_listing_agent_info_args', $args);
    // Extract $args
    extract($args, EXTR_SKIP);
    // Create listing agent info
    $listing_agent = '<div class="listing-agent listing-agent-' . $agent_id . ' author-info clearfix">';
    if ($title && !is_singular()) {
        $listing_agent .= '<div class="title title-author clearfix">';
        $listing_agent .= '<h2>' . $title . '</h2>';
        if (isset($contact) && $contact != false) {
            $listing_agent .= '<div class="title-actions title-actions-contact">' . "\n";
            $listing_agent .= '<a href="' . $contact_link . '" class="btn btn-mini"><i class="icon-envelope-alt"></i>' . __('Contact', 'wpsight') . '</a>' . "\n";
            $listing_agent .= '</div>' . "\n";
        }
        $listing_agent .= '</div><!-- .title -->';
    }
    // Get profile image or avatar
    if ($image['show'] == true) {
        $author_image = get_the_author_meta('profile_image', $agent_id);
        if (!empty($author_image)) {
            $agent_image = '<img src="' . $author_image['url'] . '" class="avatar avatar-align-' . $image['align'] . '" alt="' . $title . '" />';
        } else {
            $agent_image = '<span class="avatar-align-' . $image['align'] . '">' . get_avatar(get_the_author_meta('email', $agent_id), '80', false, $title) . '</span>';
        }
        if ($image['linked'] == true) {
            $listing_agent .= '<a href="' . get_author_posts_url($agent_id) . '" title="' . __('See my listings', 'wpsight') . '" class="avatar-wrap avatar-wrap-align-' . $image['align'] . '">';
        } else {
            $listing_agent .= '<div class="avatar-wrap avatar-wrap-align-' . $image['align'] . '">';
        }
        $listing_agent .= $agent_image;
        if ($image['linked'] == true) {
            $listing_agent .= '</a><!-- .avatar-wrap -->';
        } else {
            $listing_agent .= '</div><!-- .avatar-wrap -->';
        }
    }
    // Put text next to image in extra div
    $listing_agent .= '<div class="listing-agent-info">';
    // Display agent name on agent list
    if ($title && $location == 'list') {
        $listing_agent .= '<h2>' . get_the_author_meta('display_name', $agent_id) . '</h2>';
    }
    // 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'];
    // $listing_agent .= '<strong>' . __( 'Email', 'wpsight' ) . ':</strong> ';
    // if( $email['linked'] == true )
    // $listing_agent .= '<a href="mailto:' . antispambot( $agent_email ) . '">';
    // $listing_agent .= antispambot( $agent_email );
    // if( $email['linked'] == true )
    // $listing_agent .= '</a>';
    // $listing_agent .= '</div><!-- .listing-agent-email -->';
    // }
    // }
    // Get profile contact website
    if ($url['show'] == true) {
        $agent_url = get_the_author_meta('url', $agent_id);
        if (!empty($agent_url)) {
            $listing_agent .= '<div class="listing-agent-url">';
            if (!empty($url['icon'])) {
                $listing_agent .= $url['icon'];
            }
            $listing_agent .= '<strong>' . __('Website', 'wpsight') . ':</strong> ';
            if ($url['linked'] == true) {
                $listing_agent .= '<a href="' . $agent_url . '" target="_blank">';
            }
            $listing_agent .= $agent_url;
            if ($email['linked'] == true) {
                $listing_agent .= '</a>';
            }
            $listing_agent .= '</div><!-- .listing-agent-url -->';
        }
    }
    // Get profile contact custom fields
    foreach ($custom['fields'] as $k => $v) {
        $agent_meta = get_the_author_meta($k, $agent_id);
        if (!empty($agent_meta)) {
            $listing_agent .= '<div class="listing-agent-' . $k . '">';
            if (!empty($v['icon']) && $custom['icon'] !== false) {
                $listing_agent .= $v['icon'];
            }
            // $listing_agent .= '<strong>' . $v['label'] . ':</strong> ';
            if ($custom['linked'] == true && $v['url'] != false) {
                $url = $v['url'] . $agent_meta;
                if ($v['url'] === true) {
                    $url = $agent_meta;
                }
                $listing_agent .= '<a href="' . $url . '" target="_blank">';
            }
            if ($k == 'email') {
                $listing_agent .= '<strong><a href="mailto:' . $agent_meta . '">' . $agent_meta . '</a></strong>';
            } else {
                $listing_agent .= '<strong>' . $agent_meta . '</strong>';
            }
            if ($custom['linked'] == true && $v['url'] != false) {
                $listing_agent .= '</a>';
            }
            $listing_agent .= '</div><!-- .listing-agent-' . $k . ' -->';
        }
    }
    // Create author archive button
    if ($button == true && !is_author()) {
        // $listing_agent .= '<a href="' . get_author_posts_url( $agent_id ) . '" class="' . apply_filters( 'wpsight_button_class_agent', 'btn' ) . '">';
        // $listing_agent .= __( 'See my listings', 'wpsight' );
        // $listing_agent .= '</a>';
        $listing_agent .= '<div><i class="fa fa-user"></i> <a href="' . get_author_posts_url($agent_id) . '" class="agent-profile-link">';
        $listing_agent .= __('Agent profile', 'wpsight');
        $listing_agent .= '</a></div>';
    }
    // Get profile description/bio
    if ($bio == true) {
        $listing_agent .= '<div class="listing-agent-bio">';
        $listing_agent .= wpsight_format_content(get_the_author_meta('description', $agent_id));
        $listing_agent .= '</div><!-- .listing-agent-bio -->';
    }
    // Add link to profile for admins
    // if( current_user_can( 'edit_users' ) ) {
    // $listing_agent .= '<div class="listing-agent-profile">';
    // $listing_agent .= '<i class="icon-user"></i> <strong>' . __ ( 'Admin', 'wpsight' ) . ':</strong> ';
    // $listing_agent .= '<a href="' . admin_url( 'user-edit.php?user_id=' . $agent_id, is_ssl() ? 'https' : 'http' ) . '" class="wpsight-listing-agent-profile">' . __ ( 'See profile', 'wpsight' ) . '</a>';
    // $listing_agent .= '</div><!-- .listing-agent-profile -->';
    // }
    // Put text next to image in extra div
    $listing_agent .= '</div><!-- .listing-agent-info -->';
    // Create listing agent info
    $listing_agent .= '</div><!-- .listing-agent -->';
    // Filter and output
    echo apply_filters('wpsight_listing_agent_info', $listing_agent);
}
Ejemplo n.º 8
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $icon = isset($instance['icon']) ? strip_tags($instance['icon']) : false;
        $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
        $title_icon = isset($instance['title_icon']) ? strip_tags($instance['title_icon']) : false;
        $image = isset($instance['image']) ? $instance['image'] : false;
        $imageurl = isset($instance['imageurl']) ? $instance['imageurl'] : false;
        $size = isset($instance['size']) ? $instance['size'] : 'post-thumbnail';
        $imagewidth = isset($instance['imagewidth']) ? $instance['imagewidth'] : false;
        $height = isset($instance['height']) ? $instance['height'] : false;
        $align = isset($instance['align']) ? $instance['align'] : 'none';
        $link = isset($instance['link']) ? $instance['link'] : false;
        $text = isset($instance['text']) ? wp_kses_post($instance['text']) : false;
        $center = isset($instance['center']) ? $instance['center'] : false;
        $link_space = isset($instance['link_space']) ? strip_tags($instance['link_space']) : false;
        $width = isset($instance['width']) ? $instance['width'] : 'full';
        $position = isset($instance['position']) ? $instance['position'] : false;
        // Check widget width
        $widget_width = $width;
        // Correct box width if necessary
        if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-listing') {
            $widget_width = '';
        }
        if ($id == 'home' && ($width == wpsight_get_span('full') || $width == wpsight_get_span('half'))) {
            $widget_width = wpsight_get_span('big');
        }
        // Add class to center widget content
        $center = $center == true ? ' widget-spaces-center' : false;
        // Add width and position classes
        $position = $position == true ? ' first' : false;
        if (!empty($position)) {
            $widget_width = $widget_width . $position;
        }
        ?>

		<div id="<?php 
        echo wpsight_dashes($this->id);
        ?>
-wrap" class="widget-wrap widget-spaces-wrap <?php 
        echo $widget_width;
        ?>
">

			<div id="<?php 
        echo wpsight_dashes($this->id);
        ?>
" class="widget widget-spaces<?php 
        echo $center;
        ?>
 clearfix">

				<div class="widget-inner">

                    <?php 
        $space = '';
        if ($size != 'custom') {
            // Correct image sizes if necessary
            if ($width == wpsight_get_span('small') && !empty($size) && $size != 'post-thumbnail') {
                $size = 'post-thumbnail';
            }
            if ($width == wpsight_get_span('half') && !empty($size) && $size != 'post-thumbnail' && $size != 'half') {
                $size = 'half';
            }
            if ($width == wpsight_get_span('big') && $size == 'full') {
                $size = 'big';
            }
            // Correct image aligns if necessary
            if ($width == wpsight_get_span('small') || $id == 'sidebar' || $id == 'sidebar-home' || $width == wpsight_get_span('half') && $size == 'half' || $width == wpsight_get_span('big') && $size == 'big' || $size == 'full') {
                $align = 'none';
            }
        }
        // Correct image size if empty
        if ($size == 'custom' && (empty($width) || empty($height))) {
            $size = 'post-thumbnail';
        }
        // Check if space should be linked
        if ($link_space) {
            $url = substr($link_space, 0, 4) == 'http' ? strip_tags($link_space) : get_permalink((int) $link_space);
        }
        // Display space icon
        if (!empty($icon)) {
            $icon = '<i class="' . $icon . '"></i>';
            if (!empty($url)) {
                $icon = '<a href="' . $url . '">' . $icon . '</a>';
            }
            $space .= '<div class="space-icon">' . $icon . '</div>' . "\n";
        }
        // Display title
        if (!empty($title)) {
            if (!empty($title_icon)) {
                $title = '<i class="' . $title_icon . '"></i>' . $title;
            }
            if (!empty($url)) {
                $title = '<a href="' . $url . '">' . $title . '</a>';
            }
            $space .= '<h3 class="title">' . apply_filters('widget_title', $title, $instance, $this->id_base) . '</h3>' . "\n";
        }
        // Display image
        if ($image) {
            // Create optional image overlay
            $overlay = apply_filters('wpsight_space_image_overlay', false, $args, $instance);
            if ($size == 'custom') {
                $image_tag = '<img src="' . $imageurl . '" alt="' . strip_tags($instance['title']) . '" class="attachment-' . $size . ' spaces-post-image align' . $align . '" style="max-width:' . $imagewidth . 'px!important;height:auto" />';
            } else {
                $image_tag = wp_get_attachment_image($image, $size, false, array('class' => 'attachment-' . $size . ' spaces-post-image align' . $align));
            }
            if ($link) {
                $full_size = wp_get_attachment_image_src($image, 'full');
                $image_tag = '<a href="' . $full_size[0] . '" rel="prettyPhoto[gallery]" title="' . strip_tags($instance['title']) . '" class="space-image-zoom">' . $image_tag . $overlay . '</a>';
            } elseif (!empty($url)) {
                $image_tag = '<a href="' . $url . '">' . $image_tag . $overlay . '</a>';
            }
            $space .= '<div class="space-image">' . $image_tag . '</div>';
        }
        // Display text
        if (!empty($text)) {
            $space .= '<div class="spaces-text">' . wpsight_format_content($text) . '</div>';
        }
        echo apply_filters('wpsight_widget_spaces', $space, $args, $instance);
        ?>

                </div><!-- .widget-inner -->

            </div><!-- .widget-spaces -->

        </div><!-- .widget-wrap -->

        <?php 
    }
Ejemplo n.º 9
0
        ?>
" />
						    <?php 
    }
    // endif $args['image_lightbox']
    if (!empty($post->post_excerpt)) {
        echo '<div class="image-caption">' . wp_kses_post($post->post_excerpt) . '</div>' . "\n";
    }
    ?>
						</div><!-- .post-attachment-image -->
						
						<div class="clear"></div>
						
						<?php 
    if (!empty($post->post_content)) {
        echo '<div class="image-description">' . wpsight_format_content($post->post_content) . '</div>' . "\n";
    }
    // Action hook after post content
    do_action('wpsight_post_content_after');
    ?>
						
					</div><!-- .post-attachment --><?php 
}
// endif wp_attachment_is_image()
?>
				
	    
	    </div><!-- #content -->
	    
	    <?php 
get_sidebar();