• Resolved joshtab

    (@joshtab)


    Hello,

    Thank you for making this plugin, this is really helpful!
    I’m facing an issue: currently, we can list all entries and filter them by taxonomies. Perfect!
    However, I’d like to order them according to their parent/child relationship. Is there a way to do it, by adding PHP hooks or by using the GUI?

    Hope you’re staying safe and healthy.

    Thanks in advance,
    Josh

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hello Josh,
    you can use the ‘wpcf7_your-tag_field_post_data’ filter.

    apply_filters('wpcf7_'.$tag->name.'_field_post_data', $field_post_data, $posts, $tag, $args);

    Best regards
    Markus

    Thread Starter joshtab

    (@joshtab)

    Hey Markus,
    Thanks for answering that fast!
    Last question (sorry to bother you haha): Using this filter, how can I indent children by prepending two spaces to their label?

    If that’s too long nevermind, I’m aware that you are very busy and do the support on your free time.

    Have a nice evening,
    Josh

    Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hey Josh,
    in this case you can use the 'wpcf7_'.$tag->name.'_'.$tag->basetype.'_item_label' filter:
    $label = apply_filters('wpcf7_'.$tag->name.'_'.$tag->basetype.'_item_label', esc_html( $label ), $value, $selected, false, $ids[$key] );

    Best regards
    Markus

    Thread Starter joshtab

    (@joshtab)

    Hello,
    Thanks again for your answer!

    I must be honest and say I don’t get how/where to use it 😅

    Sorry to bother you again…
    Also, do you have a Buymeacoffee link?

    Thanks in advance,
    Have a nice day
    Josh

    Thread Starter joshtab

    (@joshtab)

    Hey, it’s me again

    I tried putting the two apply_filters in the “wpcf7_form_tag” hook but it doesn’t seem to work. To be honest, I’m sure I’m doing something wrong and would appreciate your help with a code sample if you have some time to write one please 😅

    (any BMC link?)

    Thanks again for your help,
    Have a great weekend,
    Josh

    Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hello joshtab!

    add_filter('wpcf7_your_tag_name_image_select_item_label', 'change_your_tag_name_item_label', 10, 5);
    
    function change_your_tag_name_item_label($label, $value, $selected, $tabindex, $post_id)
    {
        if( get_post($post_id)->post_parent > 0 ) {
            return '->'.$label;
        }
    
        return $label;
    }

    Best regards
    Markus

    Thread Starter joshtab

    (@joshtab)

    Hello Markus,

    Thanks a lot for your time and your help!

    I wish you an happy end of year.
    Take care, stay healthy

    Have a great weekend
    Josh 🙂

    Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hello joshtab,
    no problem 🙂

    If you like my plugin, please give me a positive rating with WordPress-Page.

    Have a great weekend
    Markus

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘List custom post types with hierarchical logic’ is closed to new replies.