'agents-details', 'description' => __( 'Display property-wise agent details.', 'apl' ) ); $control_ops = array( 'width' => 300, 'height' => 350 ); $this->WP_Widget( 'agents-details', __( 'Agent - Propertywise', 'apl' ), $widget_ops, $control_ops ); } function widget( $args, $instance ) { /** defaults */ $instance = wp_parse_args( $instance, array( 'title' => '', 'posts_per_page' => 10 ) ); extract( $args ); global $wp_query; $post_obj = $wp_query->get_queried_object(); $Page_ID = $post_obj->ID; $post_type= get_post_type( $Page_ID ); $taxonomy = 'real_estate_agents_tax'; $meta_values = wp_get_post_terms($Page_ID, $taxonomy, $args); $edit_agent_details = get_agent_by_term_id($meta_values[0]->term_id); //echo '
';print_r($edit_agent_details);
if($post_type == 'listing' && !empty($edit_agent_details)){
echo $before_widget;
if ( ! empty( $instance['title'] ) ) {
echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
}
echo '';
echo '
';
echo '';
echo ''.$edit_agent_details[0]->agent_meta_value.'
'.$edit_agent_details[2]->agent_meta_value.''.$edit_agent_details[1]->agent_meta_value.'';
echo '';
echo '';
echo '';
echo '';
echo $after_widget;
}
}
function update( $new_instance, $old_instance ) {
return $new_instance;
}
function form( $instance ) {
$instance = wp_parse_args( $instance, array(
'title' => '',
'posts_per_page' => 10
) );
printf( '', $this->get_field_id('title'), __( 'Title:', 'apl' ), $this->get_field_id('title'), $this->get_field_name('title'), esc_attr( $instance['title'] ), 'width: 95%;' );
}
}