/** * The template for displaying Listing Archive pages * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WP Listings * @since 0.1.0 */ function archive_listing_loop() { global $post; $count = 0; // start counter at 0 // Uncomment to use term image in your theme // echo '<div class="wp-listings-term-image">' . wp_listings_term_image(get_queried_object()->term_id, true, 'full') . '</div>'; // Start the Loop. while (have_posts()) { the_post(); $count++; // add 1 to counter on each loop $first = $count == 1 ? 'first' : ''; // if counter is 1 add class of first $loop = sprintf('<div class="listing-widget-thumb"><a href="%s" class="listing-image-link">%s</a>', get_permalink(), get_the_post_thumbnail($post->ID, 'listings')); if ('' != wp_listings_get_status()) { $loop .= sprintf('<span class="listing-status %s">%s</span>', strtolower(str_replace(' ', '-', wp_listings_get_status($post->ID, 1))), wp_listings_get_status()); } $loop .= sprintf('<div class="listing-thumb-meta">'); if ('' != get_post_meta($post->ID, '_listing_text', true)) { $loop .= sprintf('<span class="listing-text">%s</span>', get_post_meta($post->ID, '_listing_text', true)); } elseif ('' != wp_listings_get_property_types()) { $loop .= sprintf('<span class="listing-property-type">%s</span>', wp_listings_get_property_types()); } if ('' != get_post_meta($post->ID, '_listing_price', true)) { $loop .= sprintf('<span class="listing-price">%s</span>', get_post_meta($post->ID, '_listing_price', true)); } $loop .= sprintf('</div><!-- .listing-thumb-meta --></div><!-- .listing-widget-thumb -->'); if ('' != get_post_meta($post->ID, '_listing_open_house', true)) { $loop .= sprintf('<span class="listing-open-house">Open House: %s</span>', get_post_meta($post->ID, '_listing_open_house', true)); } $loop .= sprintf('<div class="listing-widget-details"><h3 class="listing-title"><a href="%s">%s</a></h3>', get_permalink(), get_the_title()); $loop .= sprintf('<p class="listing-address"><span class="listing-address">%s</span><br />', wp_listings_get_address()); $loop .= sprintf('<span class="listing-city-state-zip">%s, %s %s</span></p>', wp_listings_get_city(), wp_listings_get_state(), get_post_meta($post->ID, '_listing_zip', true)); if ('' != get_post_meta($post->ID, '_listing_bedrooms', true) || '' != get_post_meta($post->ID, '_listing_bathrooms', true) || '' != get_post_meta($post->ID, '_listing_sqft', true)) { $loop .= sprintf('<ul class="listing-beds-baths-sqft"><li class="beds">%s<span>Beds</span></li> <li class="baths">%s<span>Baths</span></li> <li class="sqft">%s<span>Sq ft</span></li></ul>', get_post_meta($post->ID, '_listing_bedrooms', true), get_post_meta($post->ID, '_listing_bathrooms', true), get_post_meta($post->ID, '_listing_sqft', true)); } $loop .= sprintf('</div><!-- .listing-widget-details -->'); $loop .= sprintf('<a href="%s" class="button btn-primary more-link">%s</a>', get_permalink(), __('View Listing', 'wp_listings')); /** wrap in div with column class, and output **/ printf('<article id="post-%s" class="listing entry one-third %s"><div class="listing-wrap">%s</div><!-- .listing-wrap --></article><!-- article#post-## -->', get_the_id(), $first, apply_filters('wp_listings_featured_listings_widget_loop', $loop)); if (3 == $count) { // if counter is 3, reset to 0 $count = 0; } } if (function_exists('equity')) { equity_posts_nav(); } elseif (function_exists('genesis_init')) { genesis_posts_nav(); } else { wp_listings_paging_nav(); } }
function archive_employee_loop() { $class = ''; $i = 4; if (have_posts()) { while (have_posts()) { the_post(); // starting at 4 if ($i == 4) { $class = 'first one-fourth agent-wrap'; $i = 0; } else { $class = 'one-fourth agent-wrap'; } //increase count by 1 $i++; $post_id = get_the_id(); $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id, 'employee-thumbnail', true); ?> <div <?php post_class($class); ?> itemscope itemtype="http://schema.org/Person"> <?php echo '<a href="' . get_permalink() . '"><img src="' . $thumb_url[0] . '" alt="' . get_the_title() . ' photo" class="attachment-employee-thumbnail wp-post-image" itemprop="image" /></a>'; ?> <div class="agent-details vcard"> <?php printf('<p><a class="fn" href="%s" itemprop="name">%s</a></p>', get_permalink(), get_the_title()); echo impa_employee_archive_details(); if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) { $has_listings = impa_has_listings($post_id); if (!empty($has_listings)) { echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>'; } } //echo impa_employee_social(); ?> </div><!-- .agent-details --> </div> <!-- .agent-wrap --> <?php } if (function_exists('equity')) { equity_posts_nav(); } elseif (function_exists('genesis_init')) { genesis_posts_nav(); } else { impress_agents_paging_nav(); } } else { ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?> </p> <?php } }