Free Directory, Listing & Classifieds WordPress Plugin Support General HivePress Display category and attributes in the search form

Display category and attributes in the search form

  • Author
    Posts
  • Ahmet

    How can ı change search extension ?
    I want to add location manuel and using attributes ?

    Ahmet

    I can send you an example image are there anybody know ?

    ihordeveloper

    If you enable Geolocation extension and set Google Maps API key then the “Location” field will appear automatically https://hivepress.io/docs/extensions/geolocation/ Adding categories to the main search form requires a code snippet, please consider using category selection that is already available in the filter form (on the left side when you search listings).

    Ahmet

    okey, ı deleted geolocation. I just want to adding 2 select section categories and attributes to my search form. How ? Thank you.

    ihordeveloper

    I’ll add an option to display attributes in the search form to the next version. Meanwhile, you can use this code snippet:

    And snippet suggested in this topic for displaying a custom attribute https://hivepress.io/support/topic/list-city/#post-1483

    mutange34

    This snippet didn’t work for me?

    ihordeveloper

    If you mean the first one, it should display the category drop-down like this https://prnt.sc/s8tw0x If the second one, it’s important to replace the attribute name in the snippet (“city”).

    Karim

    Hello ihor, thanks for the snippet.
    Can you tell me how to display the categories dorpdown in a correct way.
    On my site i have the dropdown list ordered by name also mains categories and sub-categories are mixed.

    It it possible to replace the first option by Categories ?
    Look here to see what i need https://prnt.sc/siyp11
    Thanks you.

    ihordeveloper

    Yes, you can add the “placeholder” argument to the list of field arguments in this snippet:

    'placeholder' => 'Categories',

    It will replace the dash. Unfortunately, there’s no simple way to display the category hierarchy in the drop-down yet, this requires further customizations.

    Karim

    Thanks for the snippet ihor.
    Can you point me how or where i can look to get the category hierarchy please, at the moment the dropdown is not usable.
    Many thanks for all your work.

    ihordeveloper

    This requires setting options as an array like this one:

    'options' => [
    	1 => [
    		'label' => 'Category 1',
    	],
    	2 => [
    		'label'  => 'Category 2',
    		'parent' => 1,
    	],
    	// ...
    ],

    This requires more customizations, e.g. fetching categories first and organizing them into an array where items reference their parent item.

    Karim

    Yes in know how to do a query in PHP/MSQL to get an array but i don’t know the Wordpres structure. Also in the admin you did it.
    Can you tell me the file i can work on to order them? I’m shure other peoples how use the categories in the search need this feature.
    Thanks in advance.

    Karim

    ihor i managed to do it thanks

    issab

    Hello @Karim how did you do it? and can you send a screenshot of how it looks?

Viewing 15 posts - 1 through 15 (of 23 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.