Agent Press Listing

Community Forums Forums General Discussion Agent Press Listing

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  JPJP9 1 month, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #118335

    JPJP9
    Member
    Post count: 2

    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;
    
    }
    
    #121787

    Tom
    Participant
    Post count: 942

    Assuming 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_mlsto _tel_number or similar to reduce term confusion, creating a new data reference.


    Choose your next site design from over 350 Genesis themes.
    Updates via GenesisThemes.ca | Twitter | Google+ | Tumblr

    #122152

    JPJP9
    Member
    Post count: 2

    Thanks 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

    #122180

    Tom
    Participant
    Post count: 942

    That’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.
    Updates via GenesisThemes.ca | Twitter | Google+ | Tumblr

    #122182

    JPJP9
    Member
    Post count: 2

    Yes 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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.