GD search by post
This topic contains 12 replies, has 4 voices, and was last updated by Guust 7 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: snippet
-
AuthorPosts
-
December 16, 2018 at 4:39 am #458772
Hi,
I have three kind of listing and in my homepage Im using two of yours GD search widget in two boxes. My problem is in both the selected listing by default is the same and I would like to set diferent listing for each one, for instance in one “places” and in the other one “events”.
December 16, 2018 at 5:12 am #458773I have asked a developer to have a look at your question, but is not possible by default.
ThanksDecember 17, 2018 at 7:06 am #458924Hello Javier,
Use following snippet and change widget id & post type accordingly.
/* * Set search default post type. */ function gd_snippet_widget_geodir_advance_search_args( $args, $instance ) { if ( ( geodir_is_page( 'home' ) || geodir_is_page( 'location' ) ) && ! empty( $args['widget_id'] ) ) { if ( $args['widget_id'] == 'geodir_advance_search-1' ) { // Change 1st widget id here. $args['post_type'] = 'gd_event'; // Change to 1st post type. } if ( $args['widget_id'] == 'geodir_advance_search-2' ) { // Change 2nd widget id here. $args['post_type'] = 'gd_place'; // Change to 2nd post type. } } return $args; } add_filter( 'widget_geodir_advance_search_args', 'gd_snippet_widget_geodir_advance_search_args', 10, 2 );Thanks,
KiranDecember 18, 2018 at 4:55 am #459093This reply has been marked as private.December 18, 2018 at 10:04 am #459115The widget ID can be found as indicated in the image. Right click on the search widget and choose “Inspect element”.
December 18, 2018 at 10:43 am #459126This feature is built into GDV2, such that the shortcode builder allows the choice of the default post type. Consider upgrading:
December 18, 2018 at 3:13 pm #459183Great! But how can I update keepin all the info I included until today?
December 18, 2018 at 5:05 pm #459200Instructions for upgrade are here:
https://wpgeodirectory.com/docs-v2/geodirectory/installation/#convert
December 18, 2018 at 6:46 pm #459218THIS IS FOR GUUST
I understant that each gedir_shortcode_location should have different ID. How can I modify “geodir_advance_search-1” to “geodir_advance_search-2”
December 18, 2018 at 8:16 pm #459225Alex I read the link but I think this use another version of geodirectory because it indicate “In the WordPress Backend visit GeoDirectory – Settings – General – Developer” but in my version there is no this option.
December 18, 2018 at 10:11 pm #459238It is the code of the snippet you need to modify, not the code of the search widget.
Everytime you add the search widget somewhere using a widget or shortcode, it will get a different geodir_advance_search-X
You need to find that by looking at the source code, and then adjust the code Kiran gave.Thanks
December 18, 2018 at 11:28 pm #459243If I expected each to have a different name but it is not, for some reason they all have the same ID
December 19, 2018 at 2:07 am #459268I guess that is because you use a page builder.
Try adding the GD Search using the shortcodes. -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket