Home Support General HivePress How to display the category selection form

How to display the category selection form

  • Author
    Posts
  • LINKOZ.RU

    Hello, please tell me how you can make the form for adding ads appear, in which you can select categories and subcategories at once. That is, to get rid of the original method.
    1редактировать картинку онлайн

    To immediately select categories and subcategories here:

    2

    ihor developer

    Sorry, this would require code customizations. If you’re familiar with code fixes please try starting with the latest snippet suggested here https://hivepress.io/support/topic/how-can-i-add-i-select-categories-from-select-box-in-add-details/#post-17056 There’s a separate “Select Category” page because the listing form may contain category-specific attributes, so the category should be selected before the form is displayed.

    LINKOZ.RU

    Unfortunately, I’m not good at coding ☹️.

    As for this code:

    add_filter(
        'hivepress/v1/forms/listing_submit',
        function( $form ) {
            $form['fields']['categories'] = [
                'type'        => 'select',
                'options'     => "terms",
                'order'     => 2,
                'label' => 'Category',
                'multiple' => false,
                'required'=>true,
                'option_args' => ["taxonomy" => "hp_listing_category"],
            ];
            return $form;        
        }
    );

    then he does not solve all the problem.

    Because when switching from the main category, the child category is also displayed.

    https://wdfiles.ru/b4ae15~i?756016f9b68e944383397afaa2f692ae

    ihor developer

    Sorry for the inconvenience, but this requires customizations. Even if you add a new Category field to the listing form the previous step (Select Category) should also be disabled via the code changes and I can’t say for sure if it’ll 100% work. We’ll try to improve this in future versions (e.g. by adding an option to switch between the form selection and a separate page selection).

    LINKOZ.RU

    That would be good! Since this is not very convenient if there is a large hierarchy of categories.

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

The topic ‘How to display the category selection form’ is closed to new replies.