?> <div id="main-wrap" class="wrap"> <?php // Action hook to add content before main do_action('wpsight_main_before'); // Open layout wrap wpsight_layout_wrap('main-middle-wrap'); ?> <div id="main-middle" class="row"> <?php // Set class of #content div depending on active sidebars $content_class = is_active_sidebar('sidebar-archive') || is_active_sidebar('sidebar') ? wpsight_get_span('big') : wpsight_get_span('full'); ?> <div id="content" class="<?php echo $content_class; ?> "> <?php if (have_posts()) { ?> <div class="title title-archive clearfix"> <?php echo apply_filters('wpsight_category_title', '<h1>' . single_cat_title('', false) . '</h1>');
<?php // Action hook to add content before main do_action('wpsight_main_before'); // Open layout wrap wpsight_layout_wrap('main-middle-wrap'); ?> <div id="main-middle" class="row"> <?php // Set class of #content div depending on active sidebars $content_class = is_active_sidebar('sidebar-archive') || is_active_sidebar('sidebar') ? wpsight_get_span('big') : wpsight_get_span('full'); // Set class depending on individual page layout if (get_post_meta(get_the_ID(), '_layout', true) == 'full-width') { $content_class = wpsight_get_span('full'); } ?> <div id="content" class="<?php echo $content_class; ?> "> <?php // Set up post data the_post(); ?> <div class="title title-archive clearfix">
<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 -->
?> <div id="main-wrap" class="wrap"> <?php // Action hook to add content before main do_action('wpsight_main_before'); // Open layout wrap wpsight_layout_wrap('main-middle-wrap'); ?> <div id="main-middle" class="row"> <?php // Set class of #content div depending on active sidebars $content_class = is_active_sidebar(wpsight_get_sidebar('sidebar-listing-archive')) ? wpsight_get_span('big') : wpsight_get_span('full'); ?> <div id="content" class="<?php echo $content_class; ?> "> <div class="title title-archive clearfix"><?php // Display current term echo apply_filters('wpsight_taxonomy_title', wpsight_listing_loop_title()); // Action hook to add content to title do_action('wpsight_loop_title_actions'); // Display term description $term_description = term_description(); if (!empty($term_description)) {
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $filter = isset($instance['filter']) ? strip_tags($instance['filter']) : false; if (!($number = (int) $instance['number'])) { $number = 1; } else { if ($number < 1) { $number = 1; } else { if ($number > 20) { $number = 20; } } } if (!($length = (int) $instance['length'])) { $length = 25; } else { if ($length < 1) { $length = 25; } } $width = isset($instance['width']) ? $instance['width'] : 'full'; // Correct width if ($width == wpsight_get_span('big') && ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter')) { $width = wpsight_get_span('full'); } if (($width == wpsight_get_span('full') || $width == wpsight_get_span('half')) && $id == 'home') { $width = wpsight_get_span('big'); } // Check widget width if ($width != 'full') { $widget_width = $width; } else { $widget_width = ''; if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { $clear = ' clearfix'; } } if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'home' && ($width == 'span12' || $width == 'full')) { $widget_width = ''; $clear = ' clearfix'; } // Create query args $query_args = array('post_type' => array('property'), '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)); } 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)); } } $query_args = apply_filters('wpsight_widget_listings_latest_query_args', $query_args); $latest = new WP_Query($query_args); if ($latest->have_posts()) { // Create loop counter $counter = 1; ?> <div id="<?php echo wpsight_dashes($widget_id); ?> -wrap" class="widget-wrap widget-latest-wrap"> <div id="<?php echo wpsight_dashes($widget_id); ?> " class="widget widget-latest row"> <?php // Display widget title if (!empty($title)) { ?> <div class="title title-widget clearfix"> <?php echo apply_filters('wpsight_widget_listings_latest_title', '<h2>' . $title . '</h2>'); do_action('wpsight_widget_listings_latest_title_actions'); ?> </div> <?php } // endif $title // Begin to loop through posts while ($latest->have_posts()) { // Set up post data $latest->the_post(); $clear = ''; // Add .clear to post class with if madness if (WPSIGHT_LAYOUT == 'four') { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 4 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-property' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-property-archive') { $widget_width = 'span3'; $clear = ' clear'; } } else { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span4') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span4') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-property' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-property-archive') { $widget_width = 'span4'; $clear = ' clear'; } } ?> <div <?php post_class($widget_width . $clear . ' clearfix'); ?> > <div class="widget-inner"> <?php // Action hook before property title (widget) do_action('wpsight_widget_listing_title_before', $width, $id); ?> <h3 class="post-title"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"> <?php // Action hook post title inside do_action('wpsight_widget_listing_title_inside'); the_title(); ?> </a> </h3> <?php // Action hook after property title (widget) do_action('wpsight_widget_listing_title_after', $width, $id); // Action hook before property content (widget) do_action('wpsight_widget_listing_content_before', $width, $id); ?> <div class="post-teaser"> <?php wpsight_the_excerpt(get_the_ID(), false, $length); ?> </div> <?php // Action hook after property content (widget) do_action('wpsight_widget_listing_content_after', $width, $id); ?> </div><!-- .widget-inner --> </div><!-- .post-<?php the_ID(); ?> --><?php // Increase loop counter $counter++; } // endwhile have_posts() ?> </div><!-- .widget --> </div><!-- .widget-wrap --><?php } // endif have_posts() }
function wpsight_do_attachment_navigation() { // Show only on attachment pages if (!is_attachment()) { return; } // Check if parent exists $post = get_post(get_the_ID()); if (empty($post->post_parent)) { return; } $previous = get_adjacent_image_link(true, 0, '← ' . __('Previous', 'wpsight')); $next = get_adjacent_image_link(false, 0, __('Next', 'wpsight') . ' →'); if (!empty($previous) || !empty($next)) { // Add class when first or last gallery item $pos = ''; if (empty($previous)) { $pos = ' first'; } if (empty($next)) { $pos = ' last'; } // Add class when span4 and we need 1/3 boxes $layout = WPSIGHT_LAYOUT == 'three' && (is_active_sidebar('sidebar') || is_active_sidebar('sidebar-post')) ? ' third' : false; $navigation = '<div class="attachment-navigation' . $pos . $layout . '"><div class="row">'; if (!empty($previous)) { $navigation .= '<div class="previous ' . wpsight_get_span('small') . '">' . $previous . '</div>'; } $navigation .= '<div class="center ' . wpsight_get_span('small') . '">' . do_shortcode('[post_parent before="" label="' . __('Back to Article', 'wpsight') . '"]') . '</div>'; if (!empty($next)) { $navigation .= '<div class="next ' . wpsight_get_span('small') . '">' . $next . '</div>'; } $navigation .= '</div></div><!-- .post-pagination -->'; echo apply_filters('wpsight_do_attachment_navigation', $navigation); } }
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'); ?> → <?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'); ?> → <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'); ?> → <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'); ?> → <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 }
function wpsight_do_listing_image($widget_width = '', $widget_location = '', $map = false) { // Get post id $post_id = get_the_ID(); if (empty($post_id)) { return; } // Don't show when password required if (post_password_required()) { return; } // Go on if there is a featured image if (has_post_thumbnail(get_the_ID())) { if (!empty($widget_width)) { // In case of a widget (lastest properties) $image_size = wpsight_get_layout_image('size_widget'); $image_align = wpsight_get_layout_image('align_widget'); // Set image size if ($widget_width == wpsight_get_span('half')) { $image_size = 'half'; } if ($widget_width == wpsight_get_span('big')) { $image_size = 'big'; } if ($widget_width == wpsight_get_span('full')) { $image_size = 'full'; } if ($widget_width == wpsight_get_span('small') || $widget_location == 'sidebar' || $widget_location == 'sidebar-home' || $widget_location == 'sidebar-page' || $widget_location == 'sidebar-post' || $widget_location == wpsight_get_sidebar('sidebar-listing') || $widget_location == wpsight_get_sidebar('sidebar-listing-archive')) { $image_size = 'post-thumbnail'; } // Remove image align $image_align = 'none'; // Limit images to box width and remove align if ($widget_width == wpsight_get_span('half') && ($image_size == 'half' || $image_size == 'big' || $image_size == 'full')) { $image_align = 'none'; } if (($widget_width == 'full' || $widget_width == wpsight_get_span('big')) && ($image_size == 'full' || $image_size == 'big') && $widget_location == 'home') { $image_align = 'none'; } if ($widget_location == 'sidebar' || $widget_location == 'sidebar-home' || $widget_width == wpsight_get_span('small')) { $image_align = 'none'; } } else { // Not in a widget but on archive pages $image_size = wpsight_get_layout_image('size_archive_listings'); $image_align = wpsight_get_layout_image('align_archive_listings'); // Get archive layout $archive_layout = wpsight_get_archive_layout('listing'); // Correct archive layout depending on sidebars if (($archive_layout == wpsight_get_span('half') || $archive_layout == wpsight_get_span('full')) && is_active_sidebar(wpsight_get_sidebar('sidebar-listing-archive'))) { $archive_layout = wpsight_get_span('big'); } if ($archive_layout == wpsight_get_span('big') && !is_active_sidebar(wpsight_get_sidebar('sidebar-listing-archive'))) { $archive_layout = wpsight_get_span('full'); } // Limit images to box width and remove align if ($archive_layout == wpsight_get_span('small')) { $image_size = 'post-thumbnail'; } if ($archive_layout == wpsight_get_span('half')) { $image_size = 'half'; } if ($archive_layout == wpsight_get_span('big')) { $image_size = 'big'; } if ($archive_layout == wpsight_get_span('full')) { $image_size = 'full'; } } // Filter image size $image_size = apply_filters('wpsight_do_listing_image_size', $image_size); // Filter image align $image_align = apply_filters('wpsight_do_listing_image_align', $image_align); // Create optional image overlay $overlay = apply_filters('wpsight_listing_image_overlay', false); // Remove link for favorites $remove = is_page_template('page-tpl-favorites.php') && empty($widget_location) ? '<span id="' . get_the_ID() . '" class="favorites-remove" title="' . __('Remove', 'wpsight') . '">' . __('Remove', 'wpsight') . '</span>' : ''; // Limit image size on properties map if (is_page_template('page-tpl-map.php') || $map === true) { $image_size = 'post-thumbnail'; } // Fincally output post image $image = '<div class="post-image listing-image align' . $image_align . '"><a href="' . get_permalink($post_id) . '">' . get_the_post_thumbnail($post_id, $image_size, array('alt' => the_title_attribute('echo=0'), 'title' => the_title_attribute('echo=0'))) . $overlay . $remove . '</a></div><!-- .post-image -->' . "\n"; echo $image = preg_replace('/\\s+/', ' ', $image); } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $cat = $instance['cat']; if (!($number = (int) $instance['number'])) { $number = 1; } else { if ($number < 1) { $number = 1; } else { if ($number > 20) { $number = 20; } } } if (!($length = (int) $instance['length'])) { $length = 25; } else { if ($length < 1) { $length = 25; } } $width = isset($instance['width']) ? $instance['width'] : 'full'; // Correct width if ($width == wpsight_get_span('big') && ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter')) { $width = wpsight_get_span('full'); } if (($width == wpsight_get_span('full') || $width == wpsight_get_span('half')) && $id == 'home') { $width = wpsight_get_span('big'); } // Check widget width if ($width != 'full') { $widget_width = $width; } else { $widget_width = ''; if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { $clear = ' clearfix'; } } if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'home' && ($width == 'span12' || $width == 'full')) { $widget_width = ''; $clear = ' clearfix'; } // Create query args $query_args = array('post_type' => array('post'), 'cat' => $cat, 'posts_per_page' => $number, 'post_status' => 'publish', 'ignore_sticky_posts' => 1); $query_args = apply_filters('wpsight_widget_latest_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 === ($latest = get_transient('wpsight_query_' . $this->id))) { // Create listing query $latest = new WP_Query($query_args); // Set transient for this query set_transient('wpsight_query_' . $this->id, $latest, DAY_IN_SECONDS); } // If query transients are not active } else { // Create listing query $latest = new WP_Query($query_args); } if ($latest->have_posts()) { // Create loop counter $counter = 1; ?> <div id="<?php echo wpsight_dashes($this->id); ?> -wrap" class="widget-wrap widget-latest-wrap"> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget widget-latest row"> <?php // Display widget title if (!empty($title)) { ?> <div class="title title-widget clearfix"> <?php echo apply_filters('wpsight_widget_latest_title', '<h2>' . $title . '</h2>', $args, $instance); do_action('wpsight_widget_latest_title_actions', $args, $instance); ?> </div> <?php } // endif $title // Begin to loop through posts while ($latest->have_posts()) { // Set up post data $latest->the_post(); $clear = ''; // Add .clear to post class with if madness if (WPSIGHT_LAYOUT == 'four') { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 4 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == wpsight_get_sidebar('sidebar-listing') || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == wpsight_get_sidebar('sidebar-listing-archive')) { $widget_width = 'span3'; $clear = ' clear'; } } else { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span4') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span4') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == wpsight_get_sidebar('sidebar-listing') || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == wpsight_get_sidebar('sidebar-listing-archive')) { $widget_width = 'span4'; $clear = ' clear'; } } ?> <div <?php post_class($widget_width . $clear . ' clearfix'); ?> > <div class="widget-inner"> <?php // Action hook before post title (widget) do_action('wpsight_widget_post_title_before', $width, $id); ?> <h3 class="post-title"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"> <?php // Action hook post title inside do_action('wpsight_widget_post_title_inside', $width, $id); the_title(); ?> </a> </h3> <?php // Action hook after post title (widget) do_action('wpsight_widget_post_title_after', $width, $id); // Action hook before post content (widget) do_action('wpsight_widget_post_content_before', $width, $id); ?> <div class="post-teaser"> <?php wpsight_the_excerpt(get_the_ID(), true, $length); ?> </div> <?php // Action hook after post content (widget) do_action('wpsight_widget_post_content_after', $width, $id); ?> </div><!-- .widget-inner --> </div><!-- .post.<?php the_ID(); ?> --><?php // Increase loop counter $counter++; } // endwhile have_posts() ?> </div><!-- .widget --> </div><!-- .widget-wrap --><?php } // endif have_posts() // Reset query wp_reset_query(); }
function wpsight_image_slider($atts) { $defaults = array('link' => '', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => get_the_ID(), 'size' => 'big', 'include' => '', 'exclude' => '', 'prevnext' => 'true', 'keynav' => 'false', 'mousenav' => 'false', 'effect' => 'fade', 'direction' => 'horizontal', 'timer' => 0); extract(shortcode_atts($defaults, $atts)); if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $args = array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby); $args = apply_filters('wpsight_image_slider_args', $args); $_attachments = get_posts($args); $attachments = array(); foreach ($_attachments as $k => $v) { $attachments[$v->ID] = $_attachments[$k]; } } else { if ($exclude == 'featured') { $exclude = get_post_thumbnail_id(get_the_ID()); } $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $args = array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby); $args = apply_filters('wpsight_image_slider_args', $args); $attachments = get_children($args); } // Stop if no attachments if (empty($attachments)) { return; } // Return attachment link list in feeds if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) { $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; } return $output; } // Get layout $layout = get_post_meta(get_the_ID(), '_layout', true); $post_type = get_post_type(); // Check full size $full_size = $layout == 'full-width' || !is_active_sidebar('sidebar') && !is_active_sidebar('sidebar-' . $post_type) ? true : false; // Correct image size $size = $full_size == true && $size == 'big' ? 'full' : $size; // Correct image size $size = $size == 'small' ? 'post-thumbnail' : $size; // Correct span depending on image size $span = $size == 'post-thumbnail' ? 'small' : $size; // Correct timer and slideshow = true $slideshow = $timer == 0 ? 'false' : 'true'; // Correct timer $timer = $timer != 0 ? $timer . '000' : 0; $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') . '",', 'animationLoop' => 'true,', 'pauseOnAction' => 'true,', 'pauseOnHover' => 'true'); $slider_args = apply_filters('wpsight_image_slider_options_args', $slider_args); // Create inline slider Javascript $output = "\n" . '<script type="text/javascript">' . "\n"; $output .= 'jQuery(document).ready(function($){' . "\n"; $output .= "\t" . '$(function(){' . "\n"; $output .= "\t\t" . '$(".flexslider").flexslider({' . "\n"; foreach ($slider_args as $k => $v) { $output .= "\t\t\t" . $k . ': ' . $v . "\n"; } $output .= "\t\t" . '});' . "\n"; $output .= "\t" . '});' . "\n"; $output .= '});' . "\n"; $output .= '</script>' . "\n\n"; /** * Set fixed height on slider container * to avoid layout jump on load */ $img = wpsight_get_image_size($size); $height = $img['size']['h']; $output .= '<div class="row"><div class="image-slider ' . wpsight_get_span($span) . '">' . "\n"; $output .= "\n\t" . '<div class="flexslider height-' . $height . '"><ul class="slides">' . "\n"; // Loop through attachments foreach ($attachments as $attachment_id => $attachment) { $output .= "\n\t\t" . '<li>'; // Link to attachment page if ($link == 'attachment') { $output .= wp_get_attachment_link($attachment_id, $size, true, false); } else { // Unlinked image $image = wp_get_attachment_image($attachment_id, $size); // Link image if desired if ($link != 'false') { $src = wp_get_attachment_image_src($attachment_id, apply_filters('wpsight_post_slider_lightbox_size', 'original')); $output .= '<a href="' . $src[0] . '" title="' . $attachment->post_title . '" class="gallery-link">' . $image . '</a>'; } else { $output .= $image; } } $output .= '</li>' . "\n"; } $output .= "\n\t" . '</ul></div><!-- .flexslider -->' . "\n"; $output .= "\n" . '</div><!-- .image-slider --></div>' . "\n"; return apply_filters('wpsight_image_slider_shortcode', $output, $atts); }
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 } }
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 }
// Action hook to add content before main do_action('wpsight_main_before'); // Open layout wrap wpsight_layout_wrap('main-middle-wrap'); ?> <div id="main-middle" class="row"> <?php // Display widget area home when active if (is_active_sidebar('home') && is_front_page()) { // Set class of #content div depending on active sidebars $content_class = is_front_page() && is_active_sidebar('home') ? wpsight_get_span('big') : wpsight_get_span('full'); // Set class of #content div on home depending on active sidebars if (is_home() && (is_active_sidebar('sidebar') || is_active_sidebar('sidebar-archive'))) { $content_class = wpsight_get_span('big'); } ?> <div id="content" class="<?php echo $content_class; ?> "> <?php dynamic_sidebar('home'); ?> </div><!-- #content --><?php get_sidebar();
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'cat' => '', 'number' => '3', 'length' => 25)); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $filter = isset($instance['filter']) ? $instance['filter'] : false; if (!isset($instance['number']) || !($number = (int) $instance['number'])) { $number = 3; } if (!isset($instance['length']) || !($length = (int) $instance['length'])) { $length = 25; } $width = isset($instance['width']) ? $instance['width'] : wpsight_get_span('small'); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'wpsight'); ?> : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </label> </p> <p> <label for="<?php echo $this->get_field_id('filter'); ?> "><?php _e('Filter', 'wpsight'); ?> :</label> <?php do_action('wpsight_widget_listings_latest_filter', $this->get_field_id('filter'), $this->get_field_name('filter'), $instance); ?> </p> <p> <label for="<?php echo $this->get_field_id('number'); ?> "><?php _e('Number of posts to show', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo $number; ?> " size="3" /><br /><small><?php _e('(at most 20)', 'wpsight'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('length'); ?> "><?php _e('Number of words in excerpt', 'wpsight'); ?> :</label> <input id="<?php echo $this->get_field_id('length'); ?> " name="<?php echo $this->get_field_name('length'); ?> " type="text" value="<?php echo $length; ?> " size="3" /> </p> <p> <label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', 'wpsight'); ?> :</label> <select class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> "> <?php foreach (wpsight_widget_widths() as $k => $v) { echo '<option value="' . $k . '"' . selected($k, $width, false) . '>' . $v . '</option>'; } ?> </select> </p><?php }
function widget($args, $instance) { extract($args, EXTR_SKIP); $property_type = isset($instance['property_type']) ? $instance['property_type'] : true; $property_location = isset($instance['property_location']) ? $instance['property_location'] : true; $property_id = isset($instance['property_id']) ? $instance['property_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() == 'property') { ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="listing-details listing-details section clearfix clear"> <div class="title clearfix"> <div class="title-price property-price listing-price"> <?php wpsight_price(); ?> </div> <?php // Action hook property details title inside do_action('wpsight_listing_details_title_inside', $args, $instance); ?> </div><!-- .title --> <?php // Display details $standard_details = wpsight_standard_details(); $property_details = ''; // Loop through standard details if (!empty($standard_details)) { $i = 0; $property_details .= '<div class="row">' . "\n"; foreach ($standard_details as $feature => $value) { // Append property ID to details if ($i == 0 && $property_id) { $property_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details_id .= '<span class="listing-details-label">' . __('Property ID', 'wpsight') . ':</span>' . "\n"; $property_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n"; $property_details_id .= '</div><!-- .listing-details-id -->' . "\n"; $property_details .= apply_filters('wpsight_listing_details_id', $property_details_id); } $property_details_value = get_post_meta(get_the_ID(), '_' . $feature, true); if (!empty($property_details_value) && $instance[$feature]) { $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n"; $property_details .= '<span class="listing-details-value">' . $property_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n"; $property_details .= '</div><!-- .property-' . $feature . ' -->' . "\n"; } $i++; } // endforeach // Add date - will be hidden by CSS display:none $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n"; $property_details .= '</div>' . "\n"; $property_details .= '</div><!-- .row -->' . "\n"; } // endif echo apply_filters('wpsight_widget_listing_details', $property_details); ?> </div><!-- .listing-details --><?php } }
<div id="main-middle" class="row"> <?php // Set class of #content div depending on active sidebars $content_class = is_active_sidebar('sidebar-post') || is_active_sidebar('sidebar') ? wpsight_get_span('big') : wpsight_get_span('full'); $args = array('full-width' => apply_filters('wpsight_attachment_full_width', false), 'image_lightbox' => true); $args = apply_filters('wpsight_attachment_image_args', $args); // Set class depending on individual page layout if ($args['full-width'] == true) { $content_class = wpsight_get_span('full'); } // Set image max size depending on active sidebars $image_big = wpsight_get_image_size('big'); $image_full = wpsight_get_image_size('full'); $image_max = $content_class == wpsight_get_span('full') ? $image_full['size']['w'] : $image_big['size']['w']; ?> <div id="content" class="<?php echo $content_class; ?> "> <?php if (wp_attachment_is_image(get_the_ID())) { $att_image = wp_get_attachment_image_src(get_the_ID(), array($image_max, $image_max)); ?> <div class="post post-attachment">