-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-listing-agentpress.php
46 lines (31 loc) · 1.59 KB
/
archive-listing-agentpress.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* The custom post type archive template
*/
/** Force full width layout */
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
/**
* Remove the standard loop
*/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'agentpress_listing_archive_loop' );
/**
* Custom loop for listing archive page
*/
function agentpress_listing_archive_loop() {
$count = 0;
if ( have_posts() ) : while ( have_posts() ) : the_post();
$count++;
$loop = ''; // init
$loop .= sprintf( '<a href="%s">%s</a>', get_permalink(), genesis_get_image( array( 'size' => 'properties' ) ) );
$loop .= sprintf( '<span class="listing-price">%s</span>', genesis_get_custom_field( '_listing_price' ) );
$loop .= sprintf( '<span class="listing-text">%s</span>', genesis_get_custom_field( '_listing_text' ) );
$loop .= sprintf( '<span class="listing-address">%s</span>', genesis_get_custom_field( '_listing_address' ) );
$loop .= sprintf( '<span class="listing-city-state-zip">%s, %s %s</span>', genesis_get_custom_field( '_listing_city' ), genesis_get_custom_field( '_listing_state' ), genesis_get_custom_field('_listing_zip' ) );
$loop .= sprintf( '<a href="%s" class="more-link">%s</a>', get_permalink(), __( 'View Listing', 'agentpress' ) );
$class = $count % 4 == 0 || $count == 1 ? 'first one-third' : 'one-third';
/** wrap in post class div, and output **/
printf( '<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join( ' ', get_post_class( $class ) ), $loop );
endwhile; endif;
}
genesis();