Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The categories field shows a list of all categories. On a hierarchical taxonomy, I was to show only the parent categories #287

Open
ketanshah79 opened this issue Aug 29, 2019 · 1 comment

Comments

@ketanshah79
Copy link

Greetings,

Problem Description

I have a df_menu_item_taxonomy taxonomy which is hierarchical (can contain nested categories)

For a divi module field of type categories I want to only show the parent (parent = 0) categories. Currently it shows all the categories including nested categories.

$fields['include_categories'] = [ 'label' => esc_html__('Include from only these categories', 'et_builder'), 'type' => 'categories', 'renderer_options' => [ 'use_terms' => true, 'term_name' => 'df_menu_item_taxonomy', ], 'tab_slug' => 'general', 'toggle_slug' => 'data', ];

The renderer_options array should be capable of take further arguments like (parent=0) so that we can have the desired effect

Steps To Reproduce

  1. Create a post type and a taxonomy which is hierarchical https://gist.github.com/ketanshah79/7f2908a4349b0734b47fa60df4c1f2b3
  2. Create a category say "Wine" and a nested category say "Red Wine"
  3. Create few custom post type entries and assign them both the above categories.
  4. Create a divi module and add the following field
    $fields['include_categories'] = [ 'label' => esc_html__('Include from only these categories', 'et_builder'), 'type' => 'categories', 'renderer_options' => [ 'use_terms' => true, 'term_name' => 'df_menu_item_taxonomy', ], 'tab_slug' => 'general', 'toggle_slug' => 'data', ];
  5. On the frontend visual builder add the created divi module.
  6. The categories checkbox list will have "Wine" and "Red Wine"

I want to show only the parent categories "Wine"

Screenshot and/or gif

Sample screenshots attached.

Nested category screenshot
image

Divi module field with nested categories item
image

@mfwd
Copy link

mfwd commented Jan 13, 2020

Having the same issue. Kindly help!

@ketanshah79 Did you find any solution?

I'm stuck at this. Is there any work around for this?
As multiple_checkboxes don't support dynamic options and custom controls are not yet supported in Divi! Referring #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants