Function Reference: geodir_buddypress_listings_html

Summary

BuddyPress Listings Tab content.

Package

GeoDirectory_BuddyPress_Integration

Parameters

$args
(array) (required) Query arguments.

Default: None

Change Log

Since: 1.0.0

Actions

‘geodir_wrapper_content_open’ [Line: 104]

‘geodir_main_content_open’ [Line: 107]

‘geodir_main_content_close’ [Line: 161]

‘geodir_wrapper_content_close’ [Line: 165]

Filters

‘gdbp_listing_post_limit’ [Line: 57]

‘gdbp_listing_layout’ [Line: 58]

‘gdbp_listing_list_sort’ [Line: 59]

‘gdbp_list_character_count’ [Line: 60]

‘geodir_template_part-widget-listing-listview’ [Line: 101]

Source File

geodir_buddypress_listings_html() is located in geodir_buddypress/includes/gdbuddypress_template_functions.php [Line: 45]

Source Code

function geodir_buddypress_listings_html( $args = array() ) {
	wp_register_style( 'gdbuddypress-style.css', GEODIR_BUDDYPRESS_PLUGIN_URL . '/css/gdbuddypress-style.css', array(), GEODIR_BUDDYPRESS_VERSION );
	wp_enqueue_style( 'gdbuddypress-style.css');
	
	global $posts_per_page, $found_posts, $paged;
	$current_posts_per_page = $posts_per_page;
	$current_found_posts = $found_posts;
	$current_paged = $paged;
	
	$posts_per_page = $posts_per_page > 0 ? $posts_per_page : 5;
			
	$post_type = $args['post_type'];
	$posts_per_page = apply_filters( 'gdbp_listing_post_limit', $posts_per_page );
	$layout = apply_filters( 'gdbp_listing_layout', '' );
	$list_sort = apply_filters( 'gdbp_listing_list_sort', 'latest' );
	$character_count = apply_filters( 'gdbp_list_character_count', 200 );
	
	$post_type_name = !empty( $args['post_type_name'] ) ? strtolower( $args['post_type_name'] ) : __( 'listings', GDBUDDYPRESS_TEXTDOMAIN );
	
	// sorting options
	add_action( 'geodir_before_listing', 'geodir_buddypress_display_sort_options' );
	add_filter( 'geodir_buddypress_posts_orderby', 'geodir_posts_orderby', 100, 1 );
	
	// pagination
	add_action( 'geodir_after_listing', 'geodir_buddypress_pagination', 20 );
	
	$query_args = array(
					'posts_per_page' => $posts_per_page,
					'is_geodir_loop' => true,
					'gd_location' 	 => false,
					'post_type' => $post_type,
					'order_by' => $list_sort
				);
	if ( $character_count ) {
		$query_args['excerpt_length'] = $character_count;
	}
	
	if ( (bool)bp_is_current_component( 'favorites' ) ) {
		$query_args['filter_favorite'] = true;
	}
	
	global $gridview_columns, $geodir_is_widget_listing;
	
	$query_args['count_only'] = true;
	$found_posts = geodir_buddypress_get_bp_listings( $query_args );
	
	$query_args['count_only'] = false;
	$widget_listings = geodir_buddypress_get_bp_listings( $query_args );
	
	$listing_view = $layout;
	if  ( strstr( $listing_view, 'gridview' ) ) {
		$gridview_columns = $listing_view;
		$listing_view_exp = explode( '_', $listing_view );
		$listing_view = $listing_view_exp[0];
	}
	
	$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php' );
	###### MAIN CONTENT WRAPPERS OPEN ######
	// this adds the opening html tags to the content div, this required the closing tag below :: ($type='',$id='',$class='')
	do_action( 'geodir_wrapper_content_open', 'listings-page', 'geodir-wrapper-content', 'gdbp-wrapper-content gdbp-listings-page' );
	
	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
	do_action( 'geodir_main_content_open', 'listings-page', 'geodir-main-content', 'gdbp-main-content  gdbp-listings-page listings-page');
	
	if ( empty( $widget_listings ) ) {
		?>
		

'; do_action( 'geodir_before_listing' ); echo '
'; // all listings html include( $template ); echo '
'; do_action( 'geodir_after_listing' ); echo '
'; // release original values global $post, $geodir_event_widget_listview, $map_jason, $map_canvas_arr; $GLOBALS['post'] = $current_post; setup_postdata( $current_post ); $geodir_event_widget_listview = $old_event_widget_listview; $map_jason = $current_map_jason; $map_canvas_arr = $current_map_canvas_arr; if ( $my_lisitngs ) { unset( $_REQUEST['geodir_dashbord'] ); remove_filter( 'geodir_after_edit_post_link_on_listing', 'geodir_buddypress_post_status_on_listing' ); } } global $posts_per_page, $found_posts, $paged; $posts_per_page = $current_posts_per_page; $found_posts = $current_found_posts; $paged = $current_paged; do_action( 'geodir_main_content_close', 'listings-page' ); ###### MAIN CONTENT WRAPPERS CLOSE ###### // this adds the closing html tags to the wrapper_content div :: ($type='') do_action( 'geodir_wrapper_content_close', 'listings-page' ); }