• Resolved schwarzgrau

    (@schwarzgrau)


    In checkboxes.html you can access the Name of the Taxonomy by using {{taxonomy}} but I need to access it in checkboxes-item.html to define a class like this
    <input type="checkbox" id="{{value}}" name="{{name}}" value="{{value}}" class="{{taxonomy}}" {{#is-selected}}checked="checked"{{/is-selected}} />

    I guess I have to change the data submitted to the Mustache-Template in walkers.php, but I don’t know how.

    https://www.ads-software.com/extend/plugins/query-multiple-taxonomies/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter schwarzgrau

    (@schwarzgrau)

    Weird, I try to achieve something for hours and a few minutes after posting on the forum I find the solution.

    If someone else trying to do something similar, which propably never will happen:

    Replace this part (line 115) of walkers.php

    $data = array_merge( $data, array(
    			'term-name' => $term->name,
    			'is-selected' => in_array( $term->slug, $this->selected_terms ) ? array(true) : false,
    			'depth' => $depth,
    		) );

    with this

    $data = array_merge( $data, array(
    			'term-name' => $term->name,
    			'is-selected' => in_array( $term->slug, $this->selected_terms ) ? array(true) : false,
    			'depth' => $depth,
    			'tax-name' => $term->taxonomy
    		) );

    and use {{tax-name}} in the checkboxes-item.html

    Hey thanks for posting that! It helped me work out how to add the term slug as a class so one can custom style each checkbox label individually:

    'term-slug' => $term->slug

    As above and use {{term-slug}} in template files.

    Thread Starter schwarzgrau

    (@schwarzgrau)

    glad to hear someone could use this stuff.
    By the way, I guess it’s ok to change core files, since the plugin will never been updated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Taxonomy Name in checkboxes-item.html’ is closed to new replies.