Sorting Listings by Custom Fields

This topic contains 5 replies, has 4 voices, and was last updated by  Paolo 7 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #401801

    Fabio Bianchi
    Buyer
    Post count: 29

    Hello,

    I would like to sort my listings using custom fields to promote specific places.

    For example, I have a radio box asking (yes or no) if wi-fi is available for the customers. Can I build a page with just the listings with wi-fi of a particular city? Can you give me an idea on how to implement that?

    Thanks!

    #401807

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    What you are asking about, GD does through Advanced Search. Our user story for this “Anonymous user is looking for hotels with wifi. The user opens the search options to specify wifi, clicks search, and see the list of hotels in the desired area with wifi.”

    Let me give you what I think would be the simplest way to do something you might like. Let’s say your custom field is called ‘wifi’. When ‘wifi’ is shown on a Hotel, it is just text, not a link. The change would be to make ‘wifi’ into a link. What you might do is create a custom function that would turn the display value of ‘wifi’ into a link to the advanced search results for hotels in the same area that have wifi. If Hotel A is in San Francisco, the word ‘wifi’ would show a page for the same latlon near me and have wifi.

    The link might look like this: (not a working link) http://www.mySuperSite.com/?geodir_search=1&stype=gd_place&sgeodir_wifi%5B%5D=&s=Hotels

    A custom page, is possible and would require more more work. I will point you to a couple of forum requests and docs that discuss custom fields or creating custom pages.

    https://wpgeodirectory.com/support/topic/custom-fields-use/
    https://wpgeodirectory.com/docs/core-place-settings/#custom
    https://wpgeo.directory/rest-api/geodirectory-rest-api-endpoints/
    https://wpgeodirectory.com/support/topic/special-offers-page/ (this page describes how a custom page can be made, but is specifically about Special Offers, and working with a custom field would be more difficult.

    #401843

    Guust
    Moderator
    Post count: 29970

    Have a look at https://wpgeodirectory.com/docs/gd-search/
    So you would add the wifi custom field to the advanced search, and then your visitors can select to see listings with wifi or no wifi.

    See here for an example: https://wpgeo.directory/starter/property/
    Click on the cogwheel (the last icon).

    Thanks

    #401857

    Fabio Bianchi
    Buyer
    Post count: 29

    Thank you, both for the answer, but that isn’t what I was asking.

    I know about the Advanced Search and to build an option to the user filter the results.

    My question is a way to build a custom page with that, doing so I have the option to promote that page addressing popular keywords related to the niche of my directory and consequently getting more traffic.

    For sure I can do that with categories, but GD architecture makes me use custom fields to set these parameters for my listings. That’s why I’m asking. I’m imagining that such feature it’s common in many directories since it is a very effective way to increase traffic.

    Any ideas?

    #401859

    Guust
    Moderator
    Post count: 29970

    You could create a redirect that redirects /wifi to the search page with those parameters.

    There is the [gd-listings] shortcode but it cannot be filtered by custom fields, only tags and categories.

    They are the only suggestions I have, anything else would require a customization.

    Thanks

    #401895

    Paolo
    Site Admin
    Post count: 31206

    Or you can link directly to the search result pages, there is no easy way with WP to filter archives by custom fields.

    Thank you

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount