Function Reference: geodir_action_add_listing_form
Summary
Outputs the add listing form HTML content.
Description
Other things are needed to output a working add listing form, you should use the add listing shortcode if needed.
Global Values
- $current_user
- (object) (required) Current user object.
- Default: None
- $post
- (object) (required) The current post object.
- Default: None
- $post_images
- (object) (required) Image objects of current post if available.
- Default: None
- $gd_session
- (object) (required) GeoDirectory Session object.
- Default: None
Package
GeoDirectory
Change Log
Since: 1.0.0
Actions
‘geodir_before_detail_fields’ [Line: 2239]
‘geodir_before_main_form_fields’ [Line: 2250]
‘geodir_before_description_field’ [Line: 2317]
‘geodir_after_description_field’ [Line: 2358]
‘geodir_before_listing_tags_field’ [Line: 2397]
‘geodir_after_listing_tags_field’ [Line: 2415]
‘geodir_after_main_form_fields’ [Line: 2535]
Filters
‘geodir_add_listing_title_label’ [Line: 2262]
‘geodir_description_field_show_editor’ [Line: 2279]
‘geodir_description_field_desc_limit’ [Line: 2289]
‘geodir_description_field_desc’ [Line: 2297]
‘geodir_description_field_desc_limit_msg’ [Line: 2308]
‘geodir_add_listing_description_label’ [Line: 2334]
‘geodir_listing_tags_field_tags_count’ [Line: 2370]
‘geodir_listing_tags_field_tags’ [Line: 2380]
‘geodir_listing_tags_field_tags_msg’ [Line: 2388]
‘geodir_image_uploader_on_add_listing’ [Line: 2479]
Source File
geodir_action_add_listing_form() is located in geodirectory_template_actions.php [Line: 2164]
Source Code
function geodir_action_add_listing_form() { global $cat_display, $post_cat, $current_user, $gd_session; $page_id = get_the_ID(); $post = ''; $title = ''; $desc = ''; $kw_tags = ''; $required_msg = ''; $submit_button = ''; $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add'; $thumb_img_arr = array(); $curImages = ''; if (isset($_REQUEST['backandedit'])) { global $post; $post = (object)$gd_session->get('listing'); $listing_type = $post->listing_type; $title = $post->post_title; $desc = $post->post_desc; $post_cat = isset($post->post_category) ? $post->post_category : ''; $kw_tags = $post->post_tags; $curImages = isset($post->post_images) ? $post->post_images : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { global $post, $post_images; $post = geodir_get_post_info($_REQUEST['pid']); $thumb_img_arr = geodir_get_images($post->ID); if ($thumb_img_arr) { foreach ($thumb_img_arr as $post_img) { $curImages .= $post_img->src . ','; } } $listing_type = $post->post_type; $title = $post->post_title; $desc = $post->post_content; $kw_tags = $post->post_tags; $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names'))); } else { $listing_type = sanitize_text_field($_REQUEST['listing_type']); } if ($current_user->ID != '0') { $user_login = true; } $post_type_info = geodir_get_posttype_info($listing_type); $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory'); $package_info = array(); $package_info = geodir_post_package_info($package_info, $post); ?>