Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Lvsm_team

class Team_Widget extends WP_Widget {

	public function __construct() {

		parent::__construct(
			'team_widget',
			__( 'Equipe', 'lvsm' ),
		);

	}

	public function widget( $args, $instance ) {


  global $post;
  $listings = new WP_Query();
  $listings->query('post_type=listings&posts_per_page=' . $numberOfListings );
  if($listings->found_posts > 0) {
    echo '<ul class="team_widget" itemscope="" itemtype="http://schema.org/Person">';
      while ($listings->have_posts()) {
        $listings->the_post();
        $listing_title = get_the_title();
        $listing_position = get_post_meta($listing->post_ID, 'teamate_position', true);
        $listing_contact = get_post_meta($listing->post_ID, 'teamate_contact_info', true);
        $listItem = '<li>';
        $listItem .= '<h4><span class="fn org" itemprop="name">'.$listing_title.'</span>, <span class="role" itemprop="jobTitle">'. $listing_position .'</span>';
        $listItem .= '<p><a href="' . strtolower($listing_contact) . '" itemprop="telephone" class="tel">' . $listing_contact . '</a></p>';
        $listItem .= '</li>';
        echo $listItem;
      }
    echo '</ul>';
    wp_reset_postdata();
  }else{
    echo '<p>'. _e('No listing found', 'lvsm').'</p>';
  }


	}

	public function form( $instance ) {

		// Set default values
		$instance = wp_parse_args( (array) $instance, array( 
			'lvsm_title' => '',
		) );

		// Retrieve an existing value from the database
		$lvsm_title = !empty( $instance['lvsm_title'] ) ? $instance['lvsm_title'] : '';

		// Form fields
		echo '<p>';
		echo '	<label for="' . $this->get_field_id( 'lvsm_title' ) . '" class="lvsm_title_label">' . __( 'Title', 'lvsm' ) . '</label>';
		echo '	<input type="text" id="' . $this->get_field_id( 'lvsm_title' ) . '" name="' . $this->get_field_name( 'lvsm_title' ) . '" class="widefat" placeholder="' . esc_attr__( 'L'equipe', 'lvsm' ) . '" value="' . esc_attr( $lvsm_title ) . '">';
		echo '</p>';

	}

	public function update( $new_instance, $old_instance ) {

		$instance = $old_instance;

		$instance['lvsm_title'] = !empty( $new_instance['lvsm_title'] ) ? strip_tags( $new_instance['lvsm_title'] ) : '';

		return $instance;

	}

}

function lvsm_register_widgets() {
	register_widget( 'Team_Widget' );
}
add_action( 'widgets_init', 'lvsm_register_widgets' );