Ejemplo n.º 1
0
function wpsight_do_listing_navigation()
{
    if (!is_listing_single()) {
        return;
    }
    $args = array('in_same_cat' => false, 'excluded_categories' => '', 'taxonomy' => 'category');
    $args = apply_filters('wpsight_do_listing_navigation_args', $args);
    // Extract $args
    extract($args, EXTR_SKIP);
    $previous = get_next_post($in_same_cat, $excluded_categories, $taxonomy);
    $next = get_previous_post($in_same_cat, $excluded_categories, $taxonomy);
    if (!empty($previous) || !empty($next)) {
        $navigation = '<div class="post-navigation clearfix">';
        if (!empty($previous)) {
            $navigation .= '<div class="previous"><a href="' . get_permalink($previous->ID) . '" title="">&larr; ' . get_the_title($previous->ID) . '</a></div>';
        }
        if (!empty($next)) {
            $navigation .= '<div class="next"><a href="' . get_permalink($next->ID) . '" title="">' . get_the_title($next->ID) . ' &rarr;</a></div>';
        }
        $navigation .= '</div><!-- .post-pagination -->';
        echo apply_filters('wpsight_do_listing_navigation', $navigation);
    }
}
Ejemplo n.º 2
0
    function widget($args, $instance)
    {
        if (is_listing_single() && has_post_thumbnail(get_the_ID())) {
            extract($args, EXTR_SKIP);
            $title = isset($instance['title']) ? strip_tags($instance['title']) : false;
            // Set image info
            $thumbnail = get_post(get_post_thumbnail_id());
            $thumbnail_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
            // Get image caption
            $caption = $thumbnail->post_excerpt ? $thumbnail->post_excerpt : false;
            // Get image alt text
            $alt = $thumbnail_alt ? $thumbnail_alt : get_the_title();
            // Get image description
            $description = $thumbnail->post_content ? $thumbnail->post_content : get_the_title();
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-image 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 description title inside
                do_action('wpsight_listing_image_title_inside', $args, $instance);
                ?>
    	
        	    	    </div>
						
					<?php 
            }
            // If in sidebar display smaller image
            $args['id'] = isset($args['id']) ? $args['id'] : false;
            $wpsight_thumb = $args['id'] == wpsight_get_sidebar('sidebar-listing') ? 'post-thumbnail' : 'big';
            // Set full width image
            if (get_post_meta(get_the_ID(), '_layout', true) == 'full-width') {
                $wpsight_thumb = 'full';
            }
            // Set full width image
            if (!is_active_sidebar(wpsight_get_sidebar('sidebar-listing'))) {
                $wpsight_thumb = 'full';
            }
            // Display featured image
            $listing_image = apply_filters('wpsight_widget_listing_image', get_the_post_thumbnail(get_the_ID(), $wpsight_thumb, array('alt' => $alt, 'title' => $description)), $args, $instance);
            // Wrap if caption
            if ($caption) {
                $listing_image = '<div class="wp-caption alignnone">' . $listing_image . '<p class="wp-caption-text">' . $caption . '</p>' . '</div><!-- .wp-caption -->';
            }
            echo $listing_image;
            ?>
				
			</div><!-- .listing-image --><?php 
        }
    }