Ajouter des champs à l'écran de modification des catégories, des balises et de la taxonomie personnalisée dans l'administrateur WordPress?
-
-
Salut Mike,je pense que ce seraitmieux si vouspostez le code dans laboîte de réponse.De cettefaçon,nous avons une sauvegardeici,au cas oùgithubtomberaiten panne.Hi mike, I think it would be better if you post the code in answer box. That way, we have backup here, in case github down.
- 0
- 2010-08-22
- ariefbayu
-
@silent: Hé,je travaille dessus.:) J'ai àmoitiéfini,maisj'ai heurté unmuret j'aibesoin de dormir.Voici à quoi cela ressemblera (quelque chose) quandj'auraiterminé: http://wordpress.stackexchange.com/questions/578/#582@silent: Hey, I'm working on it. :) I'm halfway done, but I've hit a wall and need to sleep. Here's what it'll look (something) like when I'm done: http://wordpress.stackexchange.com/questions/578/#582
- 0
- 2010-08-22
- MikeSchinkel
-
D'autres développements sur celui-ci?Je suisen fait assezintéressé ...: DAny more developments on this one? I'm actually kind of interested... :D
- 0
- 2010-09-27
- John P Bloch
-
Hé * @ John P Bloch *: Mes clientsm'ont épingléet n'onttout simplementpaseu letemps.Bientôtje l'espère...Hey *@John P Bloch*: My clients have pinned me down and just haven't had time. Hopefully soon...
- 0
- 2010-09-28
- MikeSchinkel
-
@John P Bloch Je l'aiessayéet çamarchetrèsbien,j'avaisbesoin de «grouper» certaines catégories sans catégorieparent.@John P Bloch I actually tried it and it works great, I needed to 'group' certain categories without a parent category.
- 0
- 2010-09-28
- Amit
-
@Mike: Pouvons-nous donner unpeu detraction?Jene comprendspasentièrement la question,alors vouspouvezprobablement donner unexemple?@Mike: Can we give this some traction? I don't understand the question fully, so you can probably give some example?
- 0
- 2010-12-25
- hakre
-
@hakre - Etbonnes vacances à vous aussi!;) * (Ilest vraimentfacilepourmoi deperdre latrace des choses queje voulaisfaireici sur WAparce que leur systèmene permetpas de les suivrefacilement. Je leferaismaintenantmaisj'ai un dîner de Noël auquelparticipermaintenant doncilfaudra que ce soitplustard.) *@hakre - And a happy holidays to you too! ;) *(It's really easy for me to loose trac of things I meant to do here on WA because their system doesn't give an easy way to keep track of them. I would do now but I have an Xmas dinner to attend right now so it will have to be later.)*
- 0
- 2010-12-25
- MikeSchinkel
-
Voirma réponseici: http://wordpress.stackexchange.com/questions/29322/add-custom-taxonomy-fields-when-creating-a-new-taxonomy/41483#41483See my answer here: http://wordpress.stackexchange.com/questions/29322/add-custom-taxonomy-fields-when-creating-a-new-taxonomy/41483#41483
- 0
- 2012-02-07
- Aram Kocharyan
-
6 réponses
- votes
-
- 2011-01-19
J'ai ajouté unnouveau champ 'image' (fichier detype d'entrée) à la catégorie à l'aide de ces derniers
add_action('category_edit_form_fields','category_edit_form_fields'); add_action('category_edit_form', 'category_edit_form'); add_action('category_add_form_fields','category_edit_form_fields'); add_action('category_add_form','category_edit_form'); function category_edit_form() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#edittag').attr( "enctype", "multipart/form-data" ).attr( "encoding", "multipart/form-data" ); }); </script> <?php } function category_edit_form_fields () { ?> <tr class="form-field"> <th valign="top" scope="row"> <label for="catpic"><?php _e('Picture of the category', ''); ?></label> </th> <td> <input type="file" id="catpic" name="catpic"/> </td> </tr> <?php }
Vous êtes libre d'utilisern'importe quelletaxonomie,remplacez simplement
category
par lenom de votretaxonomieI added new field 'picture' (input type file) to category with help of these
add_action('category_edit_form_fields','category_edit_form_fields'); add_action('category_edit_form', 'category_edit_form'); add_action('category_add_form_fields','category_edit_form_fields'); add_action('category_add_form','category_edit_form'); function category_edit_form() { ?> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#edittag').attr( "enctype", "multipart/form-data" ).attr( "encoding", "multipart/form-data" ); }); </script> <?php } function category_edit_form_fields () { ?> <tr class="form-field"> <th valign="top" scope="row"> <label for="catpic"><?php _e('Picture of the category', ''); ?></label> </th> <td> <input type="file" id="catpic" name="catpic"/> </td> </tr> <?php }
You are free to use any taxonomy, just replace
category
to your taxonomy name-
c'estexcellentmaispourriez-vous s'il vousplaîtexpliquer (oufournir unexemple éventuellement) comment onintégrerait correctement cettepersonnalisation si vous voulez l'ajouter à unetaxonomiepersonnalisée -parexemple "personnes"this is excellent but could you please explain (or provide an example possibly) how one would correctly integrate this customization if you want to add this to a custom taxonomy - for example "people"
- 0
- 2011-01-19
- NetConstructor.com
-
Mise àjour - Bien quej'aie copié votre codeexact ci-dessuspour letester,lefichierne semblepas êtreenregistré ou dumoinsilne s'affichepas.Pourriez-vousexpliquer oùilenregistre lefichier,peut-être que les autorisations de ce dossier doivent êtremodifiées (oumieuxencore,pourriez-vous décrire comment onprocéderaitpourmodifier l'emplacement du dossier oùilestenregistré?).Lorsqueje sélectionne unfichieret quej'essaie d'enregistrer unterme,ilenregistretout sauf lefichieret neme montre doncpas l'imagetéléchargée.Update - Although I have copied your exact code above to test this the file does not seem to be saved or at least it is not showing up. Could you explain where its saving the file, maybe the permissions of that folder need to be edited (or even better, could you possibly describe how one would go about modifying the location of the folder where its saved?). When I select a file and then try to save a term its saving everything except for the file and thus does not show me the image uploaded.
- 2
- 2011-01-19
- NetConstructor.com
-
- 2011-10-26
Deplus,si vous souhaitez ajouter ce champ dans leformulaire detaxonomiepersonnalisée,remplacez simplement la catégoriepar lenom de lataxonomiepersonnalisée dans lafonction
add_action
.Exemple:
add_action('{custom_taxonomy}_edit_form_fields','category_edit_form_fields'); add_action('{custom_taxonomy}_edit_form', 'category_edit_form'); add_action('{custom_taxonomy}_add_form_fields','category_edit_form_fields'); add_action('{custom_taxonomy}_add_form','category_edit_form');
Also, if you want to add that field into the custom taxonomy form you just substitute category with the custom taxonomy name in the
add_action
function.Example:
add_action('{custom_taxonomy}_edit_form_fields','category_edit_form_fields'); add_action('{custom_taxonomy}_edit_form', 'category_edit_form'); add_action('{custom_taxonomy}_add_form_fields','category_edit_form_fields'); add_action('{custom_taxonomy}_add_form','category_edit_form');
-
- 2013-09-27
Pour ceux qui cherchent à se connecter au champ duformulaire debalise,le crochetest légèrement différent.
add_tag_form_fields
au lieu detag_add_form_fields comme vous vousen doutez
For those looking to hook into the tag form field, the hook is slightly different.
add_tag_form_fields
instead of tag_add_form_fields as you would expect
-
- 2017-03-22
Jeme rends compte que cela a été demandéil y a quelquetemps,mais WordPress a unpeu changé depuis,j'ai donc décidé de développer unpetit script qui simplifie leprocessus d'ajout de champspersonnalisés auxtaxonomies,et vouspermet éventuellement d'ajouter des colonnes à latable destermespour chaque champ. Le script s'appelle amarkal-taxonomy et faitpartie de la Amarkal Framework WordPress.
En utilisant
amarkal-taxonomy
,l'ajout d'un champpersonnalisé simplifie à:// Add a text field to the 'category' taxonomy 'add' & 'edit' forms: amarkal_taxonomy_add_field('category', 'cat_icon', array( 'type' => 'text', 'label' => 'Icon', 'description' => 'The category\'s icon', 'table' => array( 'show' => true, // Add a column to the terms table 'sortable' => true // Make that column sortable ) )); // Then you can retrieve the data using: $icon = get_term_meta( $term_id, 'cat_icon', true );
I realize this was asked a while ago, but WordPress has changed a bit since so I decided to develop a small script that simplifies the process of adding custom fields to taxonomies, and optionally lets you add columns to the terms table for each field. The script is called amarkal-taxonomy, and is part of the Amarkal WordPress framework.
Using
amarkal-taxonomy
, adding a custom field simplifies to:// Add a text field to the 'category' taxonomy 'add' & 'edit' forms: amarkal_taxonomy_add_field('category', 'cat_icon', array( 'type' => 'text', 'label' => 'Icon', 'description' => 'The category\'s icon', 'table' => array( 'show' => true, // Add a column to the terms table 'sortable' => true // Make that column sortable ) )); // Then you can retrieve the data using: $icon = get_term_meta( $term_id, 'cat_icon', true );
-
- 2011-03-04
Vous devez ajouter votre code dans votrefichierfunctions.php dethèmes - également si vous souhaitez ajouter ce champ dans leformulaire detaxonomiepersonnalisée,vous devez simplement remplacer la catégoriepar lenom de lataxonomiepersonnalisée dans lafonction add_action. Exemple : add_action ('category_edit_form_fields','category_edit_form_fields'); sera add_action ('custom_taxonomy_name_form_fields','function_name_to_hook_on');
You need to add your code in to your themes functions.php file - also if you want to add that field into the custom taxonomy form you just substitute category with the custom taxonomy name in the add_action function. Example : add_action('category_edit_form_fields','category_edit_form_fields'); will be add_action('custom_taxonomy_name_form_fields','function_name_to_hook_on');
-
- 2012-02-05
J'utilise le Category Meta PLugin .Fonctionne surtoutes lestaxonomiespersonnalisées,baliseset amp;catégories
I use the Category Meta PLugin. Works on all custom taxonomy's, tags & categorys
La questionest " Comment ajouter un ouplusieurs champs à l'écran demodification des catégories,desbaliseset de lataxonomiepersonnalisée dans l'administration WordPress? " Cette question était demandé sur la liste wp-hackers 1er août 2010et J'aiproposé une solution plustard dans lajournée.Le demandeurinitial a denouveau discuté duproblème aujourd'hui (21 août),ce quim'a rappeléla solution.Puisqu'ilpourrait s'agir d'unbesoin courant,j'ai décidé depublier la solution,y compris le codeici,pour que d'autres letrouvent à l'avenir.