コード例 #1
0
function impa_profile_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('id' => '', 'orderby' => 'menu_order', 'order' => 'ASC'), $atts));
    if ($id == '') {
        $query_args = array('post_type' => 'employee', 'posts_per_page' => -1, 'orderby' => $orderby, 'order' => $order);
    } else {
        $query_args = array('post_type' => 'employee', 'post__in' => explode(',', $id), 'posts_per_page' => -1, 'orderby' => $orderby, 'order' => $order);
    }
    global $post;
    $profiles_array = get_posts($query_args);
    $output = '';
    foreach ($profiles_array as $post) {
        setup_postdata($post);
        $output .= '<div class="shortcode-agent-wrap">';
        $output .= '<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->ID, 'employee-thumbnail') . '</a>';
        $output .= '<div class="shortcode-agent-details"><a class="fn" href="' . get_permalink() . '">' . get_the_title() . '</a>';
        $output .= impa_employee_details();
        if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
            $has_listings = impa_has_listings($post->ID);
            if (!empty($has_listings)) {
                echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>';
            }
        }
        $output .= '</div>';
        $output .= impa_employee_social();
        $output .= '</div><!-- .shortcode-agent-wrap -->';
    }
    wp_reset_postdata();
    return $output;
}
コード例 #2
0
function single_employee_post_content()
{
    global $post;
    ?>

	<div itemscope class="entry-content impa-single-employee">

	<div class="agent-wrap" itemscope itemtype="http://schema.org/Person">
		<?php 
    $thumb_id = get_post_thumbnail_id();
    $thumb_url = wp_get_attachment_image_src($thumb_id, 'employee-full', true);
    echo '<img src="' . $thumb_url[0] . '" alt="' . get_the_title() . ' photo" class="attachment-employee-full wp-post-image" itemprop="image" />';
    ?>
		<div class="agent-details vcard">
			<span class="fn" style="display:none;" itemprop="name"><?php 
    the_title();
    ?>
</span>
			<?php 
    echo impa_employee_details();
    ?>
			<?php 
    echo impa_employee_social();
    ?>
		</div> <!-- .agent-details -->
	</div> <!-- .agent-wrap -->

	<div class="agent-bio">
		<?php 
    the_content();
    ?>
	</div><!-- .agent-bio -->

	<?php 
    if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
        echo '
		<div class="connected-agent-listings">';
        impa_connected_listings_markup();
        echo '</div>';
    }
    ?>

	</div><!-- .entry-content -->

<?php 
}
コード例 #3
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();
}