rep__employee_contact_details_html()

This function, generates HTML for displaying employee contact details based on the provided contact_details array and allows for customizing the wrapper classes.

Namespace

REP_Malcolm

Parameters

$contact_details

array

Key value pair of employee contacts.

$classes

string

Wrapper classes.

Return

string

Employee contact details.

Source

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

function rep__employee_contact_details_html( $contact_details, $classes = 'lp-contact' ){

    ob_start();

    if(is_array($contact_details) && !empty($contact_details)): ?>

        <ul class="<?= $classes; ?>"><?php

            foreach($contact_details as $key => $contact):
                if($key && $contact) : 
                
                    if($key == 'contact-form'): 

                        $contact = rep__enquiry_link_html($contact, 'Send Email', "lp-text-link"); 

                        if( $contact ): ?>
                    
                            <li class="lp-<?= $key; ?>"> <?php
                                _e( $contact ); ?>
                            </li><?php 

                        endif;

                    elseif( in_array( $key, ['phone','mobile','fax'] ) ) : ?>

                        <li class="lp-<?= $key; ?>"><?php 
                            echo lp__link_html( "tel:".lp__str_to_phone( $contact ), $contact ); ?>
                        </li><?php

                    elseif( $key == "email" ) : ?>

                        <li class="lp-<?= $key; ?>">
                            <?php _e( $contact ); ?>
                        </li><?php

                    elseif( $key == "website" ) : ?>

                        <li class="lp-<?= $key; ?>"><?php 
                            echo lp__link_html( $contact, "Visit Website", ["target" => "_blank"] ); ?>
                        </li><?php

                    else : 

                        _e( $contact );
                    
                    endif;

                endif;
            endforeach; ?>

            </ul><?php

    endif;

    return ob_get_clean();

}