Bonjour,
J'aurai besoin d'aide pour un casse tête. Possible ?
C'est un test sur un Wordpress.
Voilà j'ai créé un CustomPostType qui s'appelle "projets" avec dedans "type" (agriculture, environnement...en mode categorie) et "état" (en cours, bloqué....en mode categorie).
Du coup quand je créer un engagement je peux lui donner une famille (ex: agriculture) et un état (ex: bloqué).
Ce qui donne :
Projets
-Type
- - Agriculture
- - Environnement
- Etat
- - C'est fait
- - Bloqué
Et en fait je cherche à afficher sur une page "Projets" un compteur qui m'affiche par exemple :
Type Agriculture :
2 projets faits / 3 projets bloqués /
Type Environnement :
1 projets fait / 0 projets bloqué /
J'imagine qu'il y a un mélange à faire entre wp_count_terms et wp_list_categories ou get_taxonomies. J'ai essayé des morceaux de codes qui me donne bien des infos nécessaire à mon résultat :
Et là je me retourne la tête
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <?php echo wp_count_terms( 'type', $args ); ?> <br /> <br /> <?php echo wp_count_terms( 'etat', $args ); ?> <br /> <br /> <?php echo wp_list_categories( array( 'taxonomy'=>'type' ) ); ?> <br /> <br /> <?php echo wp_list_categories( array( 'taxonomy'=>'etat' ) ); ?> <br /> <br /> <?php $test = get_taxonomies( array( 'show_ui'=> true ) ); echo "<pre>"; print_r($test); echo "</pre>"; ?> <br /> <br /> <?php $test2 = get_terms('type'); echo "<pre>"; print_r($test2); echo "</pre>"; ?> <br /> <br /> <?php $test3 = get_terms('etat'); echo "<pre>"; print_r($test3); echo "</pre>"; ?>mais vu que je suis débutant j'aurais bien besoin d'un coup de main...
Besoin d'explications supplémentaires ? N'hésitez pas !!
Merci !
Partager