rep__get_the_agent_profile()

The function also checks if the agent’s post is hidden or if there’s a link to the agent’s page, and it handles these cases accordingly in the HTML output

Namespace

REP_Malcolm

Return

string

Agency profile

Source

File: \includes\rep-helper-functions.php

function rep__get_the_agent_profile( $post_id, $class="" ){ 
    
    $image = lp__get_primary_image( 
        array( 
            lp__get_featured_image( $post_id ),
            lp__get_field_value( 'profile_image', $post_id )
        ), "\REP_Malcolm\\rep__get_placeholder_image", "employee"
    );
    $link           = get_the_permalink( $post_id );

    $params = rep__agency_exp_url_params( $link, $post_id );

    if( !empty( $params ) && $link ){
        $link .= "?".implode("&",$params);
    }

    $hidden         = lp__get_field_value( 'hide_post', $post_id );
    $is_single_enabled = lp__get_field_value( REP__PREFIX.'_employee_single_page', 'option' );
    $is_single_enabled = $is_single_enabled === false ? true : $is_single_enabled;

    ob_start(); ?>

    <div class="rep-employee-profile <?=$class?>">
        <div class="lp-media rep-employee-media">
            <div class="lp-overlay"></div><?php 

            if( ! $hidden && $link && $is_single_enabled ): 

                ?><a class="rep-employee-link" href="<?= $link; ?>">
                    <div class="lp-image rep-employee-image" style="background-image: url(<?=$image;?>);"></div>
                </a><?php 

            else: 

                ?><div class="lp-image rep-employee-image" style="background-image: url(<?=$image;?>);"></div><?php 

            endif; ?>

        </div>
        <div class="rep-employee-content"><?php
            echo rep__employee_details_html( $post_id, ['name', 'job_title', 'rating'] ); ?>
        </div>
    </div>

    <?php $html = ob_get_clean();
    return $html;

}