/** * Get post type name to display in member profile listings Tab. * * @since 1.0.0 * @package GeoDirectory_BuddyPress_Integration * * @param string $post_type post_type of the listing. * @return string|void */ function geodir_buddypress_post_type_name($post_type = '') { $action_post_type = geodir_buddypress_action_post_type(); $post_type = $post_type != '' ? $post_type : $action_post_type; $gd_post_types = geodir_get_posttypes('array'); $return = !empty($gd_post_types) && isset($gd_post_types[$post_type]['labels']['name']) ? __($gd_post_types[$post_type]['labels']['name'], GDBUDDYPRESS_TEXTDOMAIN) : ''; return $return; }
/** * BuddyPress listings tab sort options. * * @since 1.0.0 * @package GeoDirectory_BuddyPress_Integration */ function geodir_buddypress_display_sort_options() { global $wp_query; $sort_by = isset($_REQUEST['sort_by']) ? $_REQUEST['sort_by'] : ''; $post_type = geodir_buddypress_action_post_type(); $sort_options = geodir_get_sort_options($post_type); if ($post_type && !empty($sort_options)) { $sort_field_options = ''; foreach ($sort_options as $sort) { $label = $sort->site_title; if ($sort->field_type == 'random') { $key = $sort->field_type; $selected = $sort_by == $key || $sort->is_default == '1' && !isset($_REQUEST['sort_by']) ? 'selected="selected"' : ''; $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . $label . '</option>'; } if ($sort->htmlvar_name == 'comment_count') { $sort->htmlvar_name = 'rating_count'; } if ($sort->sort_asc) { $key = $sort->htmlvar_name . '_asc'; $label = $sort->asc_title ? $sort->asc_title : $sort->site_title; $selected = $sort_by == $key || $sort->is_default == '1' && !isset($_REQUEST['sort_by']) ? 'selected="selected"' : ''; $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . $label . '</option>'; } if ($sort->sort_desc) { $key = $sort->htmlvar_name . '_desc'; $label = $sort->desc_title ? $sort->desc_title : $sort->site_title; $selected = $sort_by == $key || $sort->is_default == '1' && !isset($_REQUEST['sort_by']) ? 'selected="selected"' : ''; $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . $label . '</option>'; } } if ($sort_field_options != '') { ?> <div class="geodir-tax-sort"> <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> <option value="<?php echo esc_url(add_query_arg('sort_by', '')); ?> " <?php if ($sort_by == '') { echo 'selected="selected"'; } ?> ><?php _e('Sort By', GDBUDDYPRESS_TEXTDOMAIN); ?> </option> <?php echo $sort_field_options; ?> </select> </div> <?php } } }