arshadt87
Forum Replies Created
-
sorry the function code is this:
/** * Adding via filter or you can directly add in template file */ add_action( 'event_manager_event_filters_search_events_end', 'filter_by_city_field' ); function filter_by_city_field() { ?> <div class="search_event_types"> <label for="search_event_types"><?php _e( 'City', 'event_manager' ) ?></label> <select name="filter_by_city" class="event-manager-filter"> <option value=""><?php _e( 'Choose your city', 'event_manager' ); ?></option> <option value="mumbai"><?php _e( 'Mumbai', 'event_manager' ); ?></option> <option value="pune"><?php _e( 'Pune', 'event_manager' ); ?></option> <option value="delhi"><?php _e( 'Delhi', 'event_manager' ); ?></option> </select> </div> <?php } /** * This code gets your posted field and modifies the event search query */ add_filter( 'event_manager_get_listings', 'filter_by_city_field_query_args', 10, 2 ); function filter_by_city_field_query_args( $query_args, $args ) { if ( isset( $_POST['form_data'] ) ) { parse_str( $_POST['form_data'], $form_data ); // If this is set, we are filtering by city if ( ! empty( $form_data['filter_by_city'] ) ) { $event_city = sanitize_text_field( $form_data['filter_by_city'] ); $query_args['meta_query'][] = array( 'key' => '_event_city', 'value' => $event_city, ); } } return $query_args; }
Hi,
I used the below function code for filtering by city. Now I need to know how to connect this with the auto search field so it shows results based on ‘city’
<?php // Add custom Theme Functions here /** * @snippet WooCommerce Add New Tab @ My Account * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055 * @sourcecode https://businessbloomer.com/?p=21253 * @credits https://github.com/woothemes/woocommerce/wiki/2.6-Tabbed-My-Account-page * @author Rodolfo Melogli * @testedwith WooCommerce 2.6.7 */ // ------------------ // 1. Register new endpoint to use for My Account page // Note: Resave Permalinks or it will give 404 error function bbloomer_add_premium_support_endpoint() { add_rewrite_endpoint( 'premium-support', EP_ROOT | EP_PAGES ); } add_action( 'init', 'bbloomer_add_premium_support_endpoint' ); // ------------------ // 2. Add new query var function bbloomer_premium_support_query_vars( $vars ) { $vars[] = 'premium-support'; return $vars; } add_filter( 'query_vars', 'bbloomer_premium_support_query_vars', 0 ); // ------------------ // 3. Insert the new endpoint into the My Account menu function bbloomer_add_premium_support_link_my_account( $items ) { $items['premium-support'] = 'Event Dashboard'; return $items; } add_filter( 'woocommerce_account_menu_items', 'bbloomer_add_premium_support_link_my_account' ); // ------------------ // 4. Add content to the new endpoint function bbloomer_premium_support_content() { echo '<h3>Event Dashboard</h3><p>Welcome to the WooCommerce support area. As a premium customer, you can submit a ticket should you have any WooCommerce issues with your website, snippets or customization. <i>Please contact your theme/plugin developer for theme/plugin-related support.</i></p>'; echo do_shortcode( ' /* your shortcode here */ ' ); } add_action( 'woocommerce_account_premium-support_endpoint', 'bbloomer_premium_support_content' ); function get_event_ticket_price( $post = null ) { $post = get_post( $post ); if ( $post->post_type !== 'event_listing' ) return; return apply_filters( 'display_event_ticket_price', $post->_event_ticket_price, $post ); } function display_event_ticket_price( $before = '', $after = '', $echo = true, $post = null ) { $event_ticket_price = get_event_ticket_price( $post ); if ( strlen( $event_ticket_price ) == 0 ) return; $event_ticket_price = esc_attr( strip_tags( $event_ticket_price ) ); $event_ticket_price = $before . $event_ticket_price . $after; if ( $echo ) echo $event_ticket_price; else return $event_ticket_price; } add_action('check_admin_referer', 'logout_without_confirm', 10, 2); function logout_without_confirm($action, $result) { /** * Allow logout without confirmation */ if ($action == "log-out" && !isset($_GET['_wpnonce'])) { $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : 'https://sportsbazaar.org/sportshive/'; $location = str_replace('&', '&', wp_logout_url($redirect_to)); header("Location: $location"); die; } } /* To display the phone number of the Company / Organizer */ function get_event_phone_number( $post = null ) { $post = get_post( $post ); if ( $post->post_type !== 'event_listing' ) return; return apply_filters( 'display_event_phone_number', $post->_phone_number, $post ); } function display_event_phone_number( $before = '', $after = '', $echo = true, $post = null ) { $event_phone_number = get_event_phone_number( $post ); if ( strlen( $event_phone_number ) == 0 ) return; $event_phone_number = esc_attr( strip_tags( $event_phone_number ) ); $event_phone_number = $before . $event_phone_number . $after; if ( $echo ) echo $event_phone_number; else return $event_phone_number; } /** * Adding via filter or you can directly add in template file */ add_action( 'event_manager_event_filters_search_events_end', 'filter_by_city_field' ); function filter_by_city_field() { ?> <div class="search_event_types"> <label for="search_event_types"><?php _e( 'City', 'event_manager' ) ?></label> <select name="filter_by_city" class="event-manager-filter"> <option value=""><?php _e( 'Choose your city', 'event_manager' ); ?></option> <option value="mumbai"><?php _e( 'Mumbai', 'event_manager' ); ?></option> <option value="pune"><?php _e( 'Pune', 'event_manager' ); ?></option> <option value="delhi"><?php _e( 'Delhi', 'event_manager' ); ?></option> </select> </div> <?php } /** * This code gets your posted field and modifies the event search query */ add_filter( 'event_manager_get_listings', 'filter_by_city_field_query_args', 10, 2 ); function filter_by_city_field_query_args( $query_args, $args ) { if ( isset( $_POST['form_data'] ) ) { parse_str( $_POST['form_data'], $form_data ); // If this is set, we are filtering by city if ( ! empty( $form_data['filter_by_city'] ) ) { $event_city = sanitize_text_field( $form_data['filter_by_city'] ); $query_args['meta_query'][] = array( 'key' => '_event_city', 'value' => $event_city, ); } } return $query_args; }
This is code for location selection. What changes do I need to make in this?
<!-- Search by location section start --> <div class="col-sm-4"> <label for="search_location"><?php _e( 'Location', 'wp-event-manager' ); ?></label> <input type="text" name="search_location" id="search_location" placeholder="<?php esc_attr_e( 'Choose your City', 'wp-event-manager' ); ?>" value="<?php echo esc_attr( $location ); ?>" /> </div>
ok this works now.. Thanks.
Thanks Hitesh !!
Hi Hitesh,
Which file to edit in order to update the “contact form” fields?
It works. Thank you.
Hi Hitesh,
Thank you. I will need help in this later. Thank you.
I think coding change is not required. This functionality is readily available in the setting panel.
Account Required – checked
Account Creation – Non checked
Account Username – Non checked
Account Password – Non checkedThanks.
Hi Hitesh,
Yes I can use multi-select from the frontend editor. It’s just that the label shows the word “Array”
Live Link:
https://www.sportshive.in/event/add-venture-india-array-summer-camp-2018-vaitarna/Hi @hiteshmakvana,
Yes I added “phone number” field but how to show it on the live page. I cannot understand your documentation. Please help.
Hi @hiteshmakvana,
Thank you.
I removed “Online Event”. it works.
I tried removing “Time Format” it gets removed! But comes with default 24 hour format.
I want to make it 12 hour by default. How to make it ’12 hour format’ by default and keep it hidden?Hi @hiteshmakvana,
Great. Thank you. Price functionality works now!
Hi @hiteshmakvana ,
I am now able to display price (in INR) on the event summary box:
https://sportsbazaar.org/sportshive/Now, can you please help me to also display price on the single event page:
https://sportsbazaar.org/sportshive/event/sports-bazaar-india-mumbai-sports-bazaar-event-on-the-10th-april-2018-2/2.
Also I noticed, when price is free, it just displays Rupee symbol:
Please check the first event: https://sportsbazaar.org/sportshive/Help
Everything gets messed if I implement the Ticket price code:
PLease see this https://sportsbazaar.org/sportshive/event/sports-bazaar-india-mumbai-sports-event-title/Could you please check screenshot and help:
“content-event_listing.php” editFunction code:
Hi @hiteshmakvana,
I added the function code but i am having prob with the last code
<?php printf( __( ‘Ticket Price: %s’, ‘wp-event-manager’ ), get_event_ticket_price() ); ?>
when i put this code website goes down (500 Error).