Kiran

Forum Replies Created

Viewing 15 posts - 916 through 930 (of 6,022 total)
  • Author
    Posts
  • in reply to: Recurring Events Show the Furthest Date #521098

    Kiran
    Moderator
    Post count: 7069

    Hi Will,

    I have added following PHP snippets to achieve what you asking about.

    
    
    /**
     * Order by nearest occurrence schedule for single event.
     */
    function gd_snippet_191212_filter_widget_listings_orderby( $orderby, $table, $post_type ) {
    	global $gd_query_args_widgets;
    
    	if ( ! empty( $orderby ) && ! empty( $gd_query_args_widgets['single_event'] ) && ! empty( $gd_query_args_widgets['order_by'] ) && GeoDir_Post_types::supports( $post_type, 'events' ) ) {
    		$min_max = $gd_query_args_widgets['order_by'] == 'event_dates_desc' ? 'MAX' : 'MIN';
    		$orderby = str_replace( GEODIR_EVENT_SCHEDULES_TABLE . '.start_date ', $min_max . '( ' . GEODIR_EVENT_SCHEDULES_TABLE . '.start_date ) ', $orderby );
    		$orderby = str_replace( GEODIR_EVENT_SCHEDULES_TABLE . '.start_time ', $min_max . '( ' . GEODIR_EVENT_SCHEDULES_TABLE . '.start_time ) ', $orderby );
    	}
    
    	return $orderby;
    }
    add_filter( 'geodir_filter_widget_listings_orderby', 'gd_snippet_191212_filter_widget_listings_orderby', 20, 3 );
    
    function gd_snippet_191212_filter_widget_listings_fields( $fields, $table, $post_type ) {
    	global $gd_query_args_widgets;
    
    	if ( ! empty( $fields ) && ! empty( $gd_query_args_widgets['single_event'] ) && GeoDir_Post_types::supports( $post_type, 'events' ) ) {
    		$fields = str_replace( ", " . GEODIR_EVENT_SCHEDULES_TABLE . ".*", "", $fields );
    	}
    
    	return $fields;
    }
    add_filter( 'geodir_filter_widget_listings_fields', 'gd_snippet_191212_filter_widget_listings_fields', 20, 3 );

    Please check and let us know.

    Best Regards,
    Kiran


    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    in reply to: Rating numbers not being received via API. #521092

    Kiran
    Moderator
    Post count: 7069

    Yes, exactly in review image value should be url of the image that uploaded before.

    For now you can use media endpoint or any custom endpoint to upload image and get the image url. We have already task in our todo list to provide image upload endpoint within /geodir/v2/ api route.

    Regards,
    Kiran

    in reply to: n00b alert, how to change listing fields? #521090

    Kiran
    Moderator
    Post count: 7069

    Hi stanm,

    Use following PHP snippet to make post code & address 2 fields mandatory.

    
    
    /**
     * Make post code & address 2 mandatory in add listing form.
     */
    function gd_snippet_191212_make_zip_mandatory( $html, $cf ) {
    	if ( ! empty( $html ) ) {
    		// Make Zip/Post Code mandatory.
    		$search1 = '<div id="geodir_address_zip_row"' . PHP_EOL . '                 class="';
    		$replace1 = $search1 . 'required_field ';
    		$search2 = 'initialize_autofill_address();';
    		$replace2 = $search2 . 'var $_zip = jQuery("#geodir_address_zip_row.geodir_form_row");$_zip.append("<span class=\"geodir_message_error\">' . esc_attr__( 'Post Code is required!', 'geodirectory' ) . '</span>");jQuery("label", $_zip).append(" <span>*</span>")';
    
    		// Make Adddress 2 mandatory.
    		$search1 = '<div id="geodir_address_street2_row"' . PHP_EOL . '                 class="';
    		$replace1 = $search1 . 'required_field ';
    		$search2 = 'initialize_autofill_address();';
    		$replace2 = $search2 . 'var $_street2 = jQuery("#geodir_address_street2_row.geodir_form_row");$_street2.append("<span class=\"geodir_message_error\">' . esc_attr__( 'Town / County is required!', 'geodirectory' ) . '</span>");jQuery("label", $_street2).append(" <span>*</span>")';
    
    		$html = str_replace( array( $search1, $search2 ), array( $replace1, $replace2 ), $html );
    	}
    	return $html;
    }
    add_filter( 'geodir_custom_field_input_address', 'gd_snippet_191212_make_zip_mandatory', 100, 2 );

    Regards,
    Kiran

    in reply to: Recurring Events Show the Furthest Date #520993

    Kiran
    Moderator
    Post count: 7069

    Hi Will,

    Can you clarify more how you want to show dates?

    Kiran

    in reply to: Map not showing up in "add listing" form #520991

    Kiran
    Moderator
    Post count: 7069

    Hi acmug,

    One of plugin converting

    &

    to

    #038;

    in html and it breaks JavaScript on the page.

    Add following PHP snippet to fix this.

    
    
    /**
     * Fix changing "&" to "& #038;".
     */
    function gd_snippet_191211_the_content( $content ) {
    	if ( ! empty( $content ) && strpos( $content, "geodir_" ) !== false ) {
    		$content = str_replace( "&" . "#038;&" . "#038;", "&&", $content );
    	}
    	return $content;
    }
    add_filter( 'the_content', 'gd_snippet_191211_the_content', 9999, 1 );

    Let us know how it goes.

    Regards,
    Kiran

    in reply to: schema issue #520983

    Kiran
    Moderator
    Post count: 7069

    Hi Vlad,

    Glad to hear that rating stars are back in Google search results.

    I have checked for those listings which are still missing stars in search results. It looks like Google shows rating stars in search results for specific schema types only mentioned at here https://developers.google.com/search/docs/data-types/review-snippet#aggregated_rating_type_definition

    The listing uses schema type selected under default category from backend category edit page.

    Let us know.

    Regards,
    Kiran

    in reply to: A few issues I need to fix #520910

    Kiran
    Moderator
    Post count: 7069

    Hi Tomas,

    Done!.

    Sorry i have changed admin user language to English to check issue. I have changed a language back to site default from WordPress Admin > Edit My Profile(from admin bar right corner) > Language > Site Default.

    Thanks,
    Kiran

    in reply to: Rating numbers not being received via API. #520909

    Kiran
    Moderator
    Post count: 7069

    Hi,

    Images should be uploaded to site via media endpoint or custom endpoint and the image url can be used to add images in add listing or add review endpoints.

    Similar logic that we use in normal “add listing / add review” form. In frontend “add listing / add review” after selecting image it upload image to site via ajax and assigns the image url to listing/review during the listing/review submit.

    FYI: we have a task in todo to check & implement image upload image via our own endpoint.

    Regards,
    Kiran

    in reply to: latest update #520795

    Kiran
    Moderator
    Post count: 7069

    Hi Kathy,

    I have added one snippet under Snippets to fix image upload when there are many images to upload.

    Kiran

    in reply to: A few issues I need to fix #520784

    Kiran
    Moderator
    Post count: 7069

    Hi Thomas,

    I have selected “Auto” template from GeoDirectory > Settings > Design > Details > Page template file override.

    You can set widgets now under GD Sidebar to show on detail page

    Kiran

    in reply to: Search redirects to /location/?s= #520770

    Kiran
    Moderator
    Post count: 7069

    Thanks for letting us know.

    in reply to: I turned GeoDirectory on and all EventOn pages show 404 #520766

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    in reply to: New Detail Pages / Problem with Sidebar #520759

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    in reply to: First Steps with API and Postman #520752

    Kiran
    Moderator
    Post count: 7069

    Hi Gerrit,

    To submit reviews via REST API use following endpoints.

    1) Using basic data:

    ?post=801&content=This is comment via API&rating=5

    2) Using advance data:

    ?author=1&[email protected]&author_ip=127.0.0.1&author_name=Test User&author_url=https://www.google.co.in&status=1&post=801&content=This is comment via API&rating=5

    Regards,
    Kiran

Viewing 15 posts - 916 through 930 (of 6,022 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount