Skip to content

Instantly share code, notes, and snippets.

@jdspiral
Last active June 10, 2019 10:01
Show Gist options
  • Save jdspiral/7e07144b7949e4bfb462 to your computer and use it in GitHub Desktop.
Save jdspiral/7e07144b7949e4bfb462 to your computer and use it in GitHub Desktop.
This is a modified filter for editing the Genesis AgentPress Output
add_filter( 'agentpress_featured_listings_widget_loop', 'agentpress_featured_listings_widget_loop_filter' );
/**
* Filter the loop output of the AgentPress Featured Listings Widget.
*
*/
function agentpress_featured_listings_widget_loop_filter( $loop ) {
$loop = ''; /** initialze the $loop variable */
$loop .= sprintf( '<a href="%s">%s</a>', get_permalink(), genesis_get_image( array( 'size' => 'feature-community' ) ) );
if ( genesis_get_custom_field('_listing_price') !== '')
$loop .= sprintf( '<div class="listing-price">$%s</div>', genesis_get_custom_field('_listing_price') );
if ( genesis_get_custom_field('_listing_address') !== '')
$loop .= sprintf( '<div class="listing-address">%s</div>', genesis_get_custom_field('_listing_address') );
$custom_text = genesis_get_custom_field( '_listing_text' );
if( strlen( $custom_text ) )
$loop .= sprintf( '<div class="listing-text">%s</div>', esc_html( $custom_text ) );
//$loop .= sprintf( '<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address') );
if ( genesis_get_custom_field('_listing_city') && genesis_get_custom_field('_listing_state') && genesis_get_custom_field('_listing_zip')!== '')
$loop .= sprintf( '<div class="listing-city-state-zip">%s %s, %s</div>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip') );
if ( genesis_get_custom_field('_listing_bedrooms') !== '')
$loop .= sprintf( '<span class="listing-bedrooms">%s Beds</span> ', genesis_get_custom_field('_listing_bedrooms') );
if ( genesis_get_custom_field('_listing_bathrooms') !== '')
$loop .= sprintf( '<span class="listing-bathrooms">%s Baths</span> ', genesis_get_custom_field('_listing_bathrooms') );
// Output Square footage if not empty
if ( genesis_get_custom_field('_listing_sqft') !== '')
$loop .= sprintf( '<span class="listing-sqft">%s SqFt</span>', genesis_get_custom_field('_listing_sqft') );
//$loop .= sprintf( '<a href="%s" class="more-link">%s</a>', get_permalink(), __( 'View Listing', 'apl' ) );
return $loop;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment