Ich habe es erstellt mehrere Termlisten. Ich rufe es später auf meine eigene Bestellung an. Ich bin ein PHP-Anfänger.
Zuerst habe ich speichern, in einer anderen Variable, die ID für jede Kategorie Suchbegriff:
$terms = get_terms('my_taxonomy', 'hide_empty=0');
foreach ($terms as $term) {
${$term->slug} = get_term_by('slug', $term->slug, 'product_cat');
${$term->slug.'_array'} = (array)${$term->slug};
${$term->slug.'_array_id'} =${$term->slug.'_array'}['term_id'];
};
Dann habe ich mehrere Argumente für jede wp_list_categories()
ohne mit dieser Variablen erstellen die Begriffe ich will:
$args = array(
'taxonomy' => 'my_taxonomy',
'orderby' => 'name',
'show_count' => true,
'pad_counts' => false,
'hierarchical' => true,
'title_li' => '',
'hide_empty' => 0,
'show_option_all' => 'Show all',
'exclude' => array($term1_array_id, $term2_array_id)
);
$args_1 = array(
'taxonomy' => 'my_taxonomy',
'orderby' => 'name',
'show_count' => true,
'pad_counts' => false,
'hierarchical' => true,
'title_li' => '',
'hide_empty' => 0,
'exclude' => array($term3_array_id, $term4_array_id, $term1_array_id)
);
$args_2 = array(
'taxonomy' => 'my_taxonomy',
'orderby' => 'name',
'show_count' => true,
'pad_counts' => false,
'hierarchical' => true,
'title_li' => '',
'hide_empty' => 0,
'exclude' => array($term1_array_id, $term4_array_id, $term5_array_id)
);
Schließlich kann ich separat jeden Begriff Liste nennen:
<ul>
<?php wp_list_categories($args); ?>
<?php wp_list_categories($args_1); ?>
<?php wp_list_categories($args_2); ?>
</ul>
wow wirklich, es Hacky dann bekommt das? – Tosh