Community Forums › Forums › Archived Forums › General Discussion › Agent Press Listing
Tagged: Agentpress, featured listing, listing title
- This topic has 4 replies, 2 voices, and was last updated 10 years, 3 months ago by JPJP9.
-
AuthorPosts
-
August 12, 2014 at 12:03 am #118335JPJP9Member
Hi,
Two questions regarding this plugin:
1) How can I add the Listing Title to the Featured Listings Widget?
and
2) I have changed one of the labels in the functions.php file to Telephone (effectively rebadging that field) - is that the best way to do it?//* Filter the property details array add_filter( 'agentpress_property_details', 'agentpress_property_details_filter' ); function agentpress_property_details_filter( $details ) { $details['col2'] = array( __( 'Telephone Number:', 'agentpress' ) => '_listing_mls', __( 'Square Feet:', 'agentpress' ) => '_listing_sqft', __( 'Bedrooms:', 'agentpress' ) => '_listing_bedrooms', __( 'Bathrooms:', 'agentpress' ) => '_listing_bathrooms', __( 'Basement:', 'agentpress' ) => '_listing_basement', ); return $details; }
August 29, 2014 at 11:09 pm #121787TomParticipantAssuming you are still looking at doing this...
1. In functions.php, find
function agentpress_featured_listings_widget_loop_filter
. You can modify this code block to print the title, adding something like$loop .= sprintf( '<span class="entry-title">' . ( get_the_title() ) . '</span>' );
The title text location and appearance can be manipulated by ordering this line in the loop amongst the others and with CSS.2. You should also change the variable name from
_listing_mls
to_tel_number
or similar to reduce term confusion, creating a new data reference.
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]August 31, 2014 at 9:27 pm #122152JPJP9MemberThanks heaps for your reply Tom.
Couldn't find that function in the function.php file? but changed a line in class-featured-listings-widget.php
to this
$loop .= sprintf('<span class="entry-title">' . ( get_the_title() ) . '</span>'.'<a href="%s">%s</a>', get_permalink(), genesis_get_image( array( 'size' => 'properties' ) ) );
and seems to be working.
thanks heaps
September 1, 2014 at 12:33 am #122180TomParticipantThat's not a good way to make this change. The code in class-featured-listings-widget.php will be overwritten by plugin updates and your change will be lost. What is the theme that you are using?
You can add the following filter to your functions.php, modified with your HTML mods:
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' => 'properties' ) ) ); $loop .= sprintf( '<span class="entry-title">' . ( get_the_title() ) . '</span>' ); $loop .= sprintf( '<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price') ); $custom_text = genesis_get_custom_field( '_listing_text' ); if( strlen( $custom_text ) ) $loop .= sprintf( '<span class="listing-text">%s</span>', esc_html( $custom_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', 'apl' ) ); return $loop; }
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]September 1, 2014 at 12:59 am #122182JPJP9MemberYes what you are saying definitely makes sense.
I'm using the Agent Press theme but could not find that function in the functions.php file
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.