Site logo

Archived topic

code snippet to display parent name in rules dropdown

7 replies · Started by jr on May 12, 2021

Viewing posts 1–8 of 8

When adding display rules to elements, is there a code snippet to display the category name in a format that includes the parent category? Maybe something like this: "Child Category Name (Parent Category)" in the Categories drop-down search?

Hi there,

The labels have no filter we can use to edit and add variables, unfortunately.

Hello,

Are you able to view the email and image Leo replied to yesterday?
How can different categories be identified in the drop-down if they have the same name?

thank you

Hi there,

tricky one that ... what type of Element are you using?

Hi,

Element type is "Block - Left Sidebar".

And it doesn't need to have the parent category as I first wrote; that was just an idea, maybe displaying the category id next to the category name would be easier to accomplish via a snippet.

I'm basically looking for any way to differentiate identical category names in the display rules dropdown.

thank you

Definitely a tricky one - there should be a way to do this.

Try adding this filter: add_filter( 'generate_elements_show_object_ids', '__return_true' );

Let me know :)

Hi Tom,
Thank you, worked perfectly.

Awesome, glad I could help! :)

This archived topic is closed to new replies.