Uživatelské taxonomie, přidávání uživatelských polí k taxonomiím

„Custom user taxonomies »“:http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress

*

To add a custom field to your custom taxonomy, add the following code to your theme’s functions.php:
/—code php
// A callback function to add a custom field to our „presenters“ taxonomy
function presenters_taxonomy_custom_fields($tag) {
// Check for existing taxonomy meta for the term you’re editing
$t_id = $tag->term_id; // Get the ID of the term you’re editing
$term_meta = get_option( „taxonomy_term_$t_id“ ); // Do the check
?>

term_id“ );
// Return the value for the „presenter_id“ custom field
$presenter_data = get_userdata( $presenter_custom_fields[presenter_id] ); // Get their data
\—

To see what data is stored inside the custom fields you created, add the print_r function to your template, then preview it:
/—code php
‚; print_r( $presenter_custom_fields ); echo ‚

‚;
?>
\—

To keep it dynamic, we are passing in the „presenter_id“ field of our $presenter_custom_fields variable. Now, to see what data you have to work with, use print_r again:
/—code php
‚; print_r( $presenter_data ); echo ‚

‚;
?>
\—
„Zdroj: How To Add Custom Fields To Custom Taxonomies »“:http://sabramedia.com/blog/how-to-add-custom-fields-to-custom-taxonomies

***

To add a form field to the Edit Category screen we’ll use the edit_category_form_fields action hook available in WordPress:
/—code php
term_id, $cat_featured ) ) {
$featured_id = $cat_featured[$tag->term_id] ;
}
?>

The post ID that will be the featured post when viewing this category.


\—
The above code will add a single text field (Featured Post ID) to the Edit Category screen.

Now we need to save the input to our option array. To capture the ID when a category is updated we’ll use the edited_category action hook like so:

/—code php

\—
As you can see we are saving the Category ID and Featured Post ID as a single associative array option value in WordPress named category_featured. As you add Featured Post ID values to each of your categories they will be added to this array and saved in WordPress.

„Save Taxonomy Meta Data as an Options Array in WordPress »“:http://strangework.com/2010/07/01/how-to-save-taxonomy-meta-data-as-an-options-array-in-wordpress/

***

„How to Add Custom Meta Fields to Custom Taxonomies in WordPress »“:http://www.wpbeginner.com/wp-tutorials/how-to-add-additional-custom-meta-fields-to-custom-taxonomies/

„Adding Custom Meta Fields to Taxonomies »“:https://pippinsplugins.com/adding-custom-meta-fields-to-taxonomies/

„How To Add Custom Fields To Custom Taxonomies»“:http://sabramedia.com/blog/how-to-add-custom-fields-to-custom-taxonomies

„WordPress: Adding custom fields to taxonomies »“:http://www.journal.deviantdev.com/wordpress-adding-custom-fields-to-taxonomies/

„WordPress Taxonomies Extra Fields the easy way »“:https://en.bainternet.info/wordpress-taxonomies-extra-fields-the-easy-way/

„Hooking WordPress Taxonomy Changes With The Plugins API »“:https://www.dougv.com/2014/06/hooking-wordpress-taxonomy-changes-with-the-plugins-api/

„Extending WordPress Taxonomies »“:http://www.sitepoint.com/extending-wordpress-taxonomies/