コード例 #1
0
/**
 * Outputs markup for the connected agents on single listings
 */
function impa_connected_agents_markup()
{
    $profiles = impa_get_connected_posts_of_type('agents_to_listings');
    if (empty($profiles)) {
        return;
    }
    echo apply_filters('impa_connected_agent_heading', $heading = '<h4>Listing Presented by:</h4>');
    global $post;
    foreach ($profiles as $profile) {
        setup_postdata($profile);
        $post = $profile;
        $thumb_id = get_post_thumbnail_id();
        $thumb_url = wp_get_attachment_image_src($thumb_id, 'agent-profile-photo', true);
        echo '
		<div ', post_class('connected-agents vcard'), ' itemscope itemtype="http://schema.org/Person">
			<div class="agent-thumb"><a href="', get_permalink($profile->ID), '"><img src="', $thumb_url[0], '" alt="', get_the_title(), ' photo" class="attachment-agent-profile-photo wp-post-image alignleft" itemprop="image" /></a></div><!-- .agent-thumb -->
			<div class="agent-details"><h5><a class="fn agent-name" itemprop="name" href="', get_permalink($profile->ID), '">', get_the_title($profile->ID), '</a></h5>';
        echo impa_employee_details();
        echo impa_employee_social();
        echo '</div><!-- .agent-details --></div><!-- .connected-agents .vcard -->';
    }
    echo '<div class="clearfix"></div>';
    wp_reset_postdata();
}
コード例 #2
0
function impa_employee_archive_details()
{
    global $post;
    $output = '';
    if (get_post_meta($post->ID, '_employee_title', true) != '') {
        $output .= sprintf('<p class="title" itemprop="jobTitle">%s</p>', get_post_meta($post->ID, '_employee_title', true));
    }
    if (get_post_meta($post->ID, '_employee_phone', true) != '') {
        $output .= sprintf('<p class="tel" itemprop="telephone"><span class="type">Office</span>: <span class="value">%s</span></p>', get_post_meta($post->ID, '_employee_phone', true));
    }
    if (get_post_meta($post->ID, '_employee_email', true) != '') {
        $email = get_post_meta($post->ID, '_employee_email', true);
        $output .= sprintf('<p><a class="email" itemprop="email" href="mailto:%s">%s</a></p>', antispambot($email), antispambot($email));
    }
    if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
        $listings = impa_get_connected_posts_of_type('agents_to_listings');
        if (!empty($listings)) {
            echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>';
        }
    }
    return $output;
}