Last active
June 28, 2016 18:35
-
-
Save jtallant/4713092 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This snippet goes in functions.php | |
add_filter('agentpress_featured_listings_widget_loop', 'child_ap_listings_loop_filter', 10, 1 ); | |
/** | |
* Adds some additional button classes to the more link | |
* | |
* These button classes are already defined in the theme | |
* style.css file. Adding them to the listing wrap "more link" | |
* will give the "View Listing" buttons styling that is | |
* consistent with the theme. | |
*/ | |
function child_ap_listings_loop_filter($loop) { | |
return str_replace('more-link', 'btn btn-primary more-link', $loop); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* AgentPress Listings - General | |
------------------------------------------------------------ */ | |
.single-listing .post-info, | |
.single-listing .post-meta { | |
display: none; | |
} | |
.sidebar .property-search { | |
background: transparent; | |
} | |
.single-listing .entry-content h4 { | |
font-size: 24px; | |
margin-bottom: 15px; | |
} | |
/* AgentPress Listings - Property Listings | |
------------------------------------------------------------ */ | |
.property-details { | |
background-color: #f5f5f5; | |
overflow: hidden; | |
margin: 0 0 30px; | |
padding: 15px 20px 0; | |
} | |
.property-details-col1, | |
.property-details-col2 { | |
float: left; | |
margin: 0; | |
padding: 0 0 15px; | |
width: 50%; | |
} | |
.single-listing .entry-content iframe { | |
margin: 0 0 30px; | |
} | |
/* AgentPress Listings - Featured Listings | |
------------------------------------------------------------ */ | |
.listing-wrap { | |
float: left; | |
font-size: 12px; | |
margin: 0 30px 45px 0; | |
position: relative; | |
width: 290px; | |
} | |
.post-type-archive-listing .listing-wrap { | |
width: auto; | |
margin: 20px 0; | |
} | |
.post-type-archive-listing .listing-wrap a img { | |
width: auto; | |
} | |
.listing-wrap a img { | |
margin: 0 0 10px; | |
padding: 4px; | |
background: #fff; | |
border: 1px solid #959595; | |
} | |
.widget.featured-listings .listing-wrap a img { | |
width: 280px; | |
} | |
.listing-price { | |
background: #000; | |
background: rgba(0,0,0,0.80); | |
clear: both; | |
color: #fff; | |
font-size: 16px; | |
left: 5px; | |
padding: 10px; | |
position: absolute; | |
top: 5px; | |
} | |
.listing-text { | |
background: #fff; | |
clear: both; | |
font-size: 12px; | |
padding: 5px 10px; | |
position: absolute; | |
right: 5px; | |
top: 5px; | |
} | |
.post-type-archive-listing .listing-text { | |
right: -5px; | |
} | |
.listing-address, | |
.listing-city-state-zip { | |
display: block; | |
font-size: 14px; | |
line-height: 14px; | |
margin: 0 0 5px; | |
padding: 0; | |
text-align: center; | |
text-transform: uppercase; | |
} | |
.listing-city-state-zip { | |
margin: 0 0 10px; | |
} | |
.listing-wrap .more-link { | |
margin: 0 auto; | |
display: block; | |
width: 80px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The 'listing' custom post type archive template | |
* | |
* This file goes inside your theme folder | |
*/ | |
/** | |
* 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', 'child_listing_archive_loop' ); | |
/** | |
* Custom loop for listing archive page | |
*/ | |
function child_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' ) ); | |
if ( genesis_get_custom_field('_listing_text') ) { | |
$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 btn btn-primary">%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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jtallant you're the only person I've found who has been able to rewrite the AgentPress listings taxonomy.php page with any amount of authority or success. However, I noticed that the 7th listing (on my AgentPress install) is output with the wrong class name and sits on a row by itself. I've also failed at many attempts to sort listings by title or exceed the transparent cap of 10 listings per term page. Any insight into that?