Metadata v taxonomiích

Category and Taxonomy Meta Fields
https://wordpress.org/…xonomy-meta/

Plugin to add custom meta fields within built in and custom taxonomies. Simply add the desired fields by going through WP-admin -> Settings ->Taxonomy Meta .
You can add following fields with category/taxonomy:

  • Image
  • Input Text
  • Textarea
  • Checkbox

Taxonomy Metadata
https://wordpress.org/…my-metadata/

This plugin implements the metadata infrastructure for taxonomy terms, so you can add custom metadata (by key) to tags, categories, and other taxonomies. The majority of the code is from sirzooro's submission to the WordPress Core Trac. The rest of the plugin is simply some hacky glue to make this work without modifying the Core. It does not implement any UI for taxonomy term metadata.

Meta for taxonomies
https://wordpress.org/…-taxonomies/

Add meta for any taxonomies. Meta is attached to taxonomy context and not terms, this way allow to have metas different for the same term on 2 different taxonomies. This plugin don't any interface on WordPress ! Only somes methods for developpers.

Taxonomy Images
https://wordpress.org/…nomy-images/

Associate images from your media library to categories, tags and custom taxonomies.

Carbon Fields
https://wordpress.org/…rbon-fields/

Developer-oriented library for WordPress custom fields for all types of WordPress content.
Carbon fields is a plugin that can be used as a library for easy creation of custom fields in the WordPress administration panel.
Can be created for post types, taxonomy terms, users, comments, options, navigation menus and even widgets.

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

Custom user taxonomies »

*

To add a custom field to your custom taxonomy, add the following code to your theme's functions.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
?>
<tr class="form-field">
    <th scope="row" valign="top">
        <label for="presenter_id"><?php _e('WordPress User ID'); ?></label>
    </th>
    <td>
        <input type="text" name="term_meta[presenter_id]" id="term_meta[presenter_id]" size="25" style="width:60%;" value="<?php echo $term_meta['presenter_id'] ? $term_meta['presenter_id'] : ''; ?>"><br />
        <span class="description"><?php _e('The Presenter\'s WordPress User ID'); ?></span>
    </td>
</tr>
<?php
}

Next, we'll create a callback function that we'll use to save our custom fields. Add the following code to your theme's functions.php:

// A callback function to save our extra taxonomy field(s)
function save_taxonomy_custom_fields( $term_id ) {
if ( isset( $_POST['term_meta'] ) ) {
    $t_id = $term_id;
    $term_meta = get_option( "taxonomy_term_$t_id" );
    $cat_keys = array_keys( $_POST['term_meta'] );
    foreach ( $cat_keys as $key ){
        if ( isset( $_POST['term_meta'][$key] ) ){
            $term_meta[$key] = $_POST['term_meta'][$key];
        }
    }
//save the option array
update_option( "taxonomy_term_$t_id", $term_meta );
}
}

Let's associate these callback functions to the "edit" screen for our custom taxonomies. Add the following code to your theme's functions.php:

// Add the fields to the "presenters" taxonomy, using our callback function
add_action( 'presenters_edit_form_fields', 'presenters_taxonomy_custom_fields', 10, 2 );
// Save the changes made on the "presenters" taxonomy, using our callback function
add_action( 'edited_presenters', 'save_taxonomy_custom_fields', 10, 2 );

To access a custom field added to your custom taxonomy using the method noted earlier, add the following code inside your custom taxonomy template (in our case, taxonomy-presenters.php), within the PHP block at the top:

// Get the custom fields based on the $presenter term ID
$presenter_custom_fields = get_option( "taxonomy_term_$presenter->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:

<?php
    echo '<pre>';
    print_r( $presenter_custom_fields );
    echo '</pre>';
?>

To keep it dynamic, we are passing in the "presenter_id" field of our $presenter_cus­tom_fields variable. Now, to see what data you have to work with, use print_r again:

<?php
    echo '<pre>';
    print_r( $presenter_data );
    echo '</pre>';
?>

Zdroj: How To Add Custom Fields To Custom Taxonomies »


To add a form field to the Edit Category screen we’ll use the edit_category_for­m_fields action hook available in WordPress:

<?php
add_action ( 'edit_category_form_fields', 'tme_cat_featured');

function tme_cat_featured( $tag ) {

//check for existing featured ID
$cat_featured = get_option( 'category_featured' );
$featured_id = '';
if ( is_array( $cat_featured ) && array_key_exists( $tag->term_id, $cat_featured ) ) {
     $featured_id = $cat_featured[$tag->term_id] ;
}
?>
<tr class="form-field">
    <th scope="row" valign="top"><label for="category_featured"><?php _e('Featured Post ID') ?></label></th>
    <td>
        <input type="text" name="category_featured" id="category_featured" size="3" style="width:5%;" value="<?php echo $featured_id; ?>"><br />
        <span class="description">The post ID that will be the featured post when viewing this category.</span>
    </td>
</tr>
<?php
}
?>

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:

<?php
add_action ( 'edited_category', 'tme_save_featured');

function tme_save_featured( $term_id ) {
if ( isset( $_POST['category_featured'] ) ) {

    //load existing category featured option
    $current_featured = get_option( 'category_featured' );

    //set featured post ID to proper category ID in options array
    $current_featured[$term_id] = intval( $_POST['category_featured'] );

    //save the option array
     update_option( 'category_featured', $current_featured );
    }
}
?>

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 »


How to Add Custom Meta Fields to Custom Taxonomies in WordPress »

Adding Custom Meta Fields to Taxonomies »

How To Add Custom Fields To Custom Taxonomies»

WordPress: Adding custom fields to taxonomies »

WordPress Taxonomies Extra Fields the easy way »

Hooking WordPress Taxonomy Changes With The Plugins API »

Extending WordPress Taxonomies »

Nastavení defaultní hodnoty pro tagy a uživatelské taxonomie

Příspěvek se automaticky zařadí do výchozí rubriky, i když ji nepřiřadíme. To ale neplatí pro štítky (tagy) a uživatelské taxonomie.
Jak to nastavit v tomto případě:

function mfields_set_default_object_terms( $post_id, $post ) {
    if ( 'publish' === $post->post_status ) {
        $defaults = array(
            'post_tag' => array( 'štítek 1', 'štítek 2' ),
            'moje taxonomue' => array( 'Defaultní hodnota' ),
            );
        $taxonomies = get_object_taxonomies( $post->post_type );
        foreach ( (array) $taxonomies as $taxonomy ) {
            $terms = wp_get_post_terms( $post_id, $taxonomy );
            if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) {
                wp_set_object_terms( $post_id, $defaults[$taxonomy], $taxonomy );
            }
        }
    }
}
add_action( 'save_post', 'mfields_set_default_object_terms', 100, 2 );

http://wordpress.mfields.org/…rdpress-3-0/

Rich text editor (Tiny MCE) pro popisky tagů. rubrik a dalších taxonomií

The Rich Text Tags - A TinyMCE Editor for Tags, Categories, and Taxonomies
http://wordpress.org/…h-text-tags/

The Rich Text Tags Plugin allows you to edit tag descriptions, category descriptions, and taxonomy descriptions using WordPress' built in rich-text editor. Switch between WYSIWYG and HTML editing modes with the click of a link. Use the WordPress uploader to insert images from your computer or site's Media Library.

Use the WordPress functions tag_description() and category_descrip­tion() in your theme to show the descriptions. To learn how to show taxonomy descriptions, read more on the plugin page. Features

  • Edit term descriptions with WordPress's built-in WYSIWYG editor
  • Works with custom taxonomies (and custom post types, introduced in WP 3.0)
  • Now supports user biography fields!

Různé typy příspěvků, taxonomie, metaboxy

Custom post types in WordPress »

A refresher on custom taxonomies »

Introducing WordPress 3 Custom Taxonomies »

"Innovative Uses of WordPress Post Types and Taxonomies ":http://wp.tutsplus.com/…-taxonomies/

Custom Fields 101: Tips, Tricks, and Hacks »

Publish Action Hook for Custom Post Types »

WordPress Custom Taxonomy Input Panels »

Revisiting Custom Post Types, Custom Taxonomies, and Permalinks »

WordPress Custom Post Type Code Generator »

Jak vytvořit vlastní metabox »

How To Create Custom Post Meta Boxes »

Using custom meta box is a great way to make custom fields more friendly to users. It helps us much to add extra information to a post.

Viz též Add A Meta Box In WordPress »

Custom Post Type UI
http://wordpress.org/…ost-type-ui/
http://webdevstudios.com/…ess-plugins/

This plugin provides an easy to use interface to create and administer custom post types in WordPress. Plugin can also create custom taxonomies. This plugin is created for WordPress 3.0.

WP Easy Post Types
http://wordpress.org/…-post-types/

This plugin lets you take advantage of the WordPress 3.0 custom post type feature, and create your own post type. The plugin allows you to add a set of fields attached to your new post type, so that in the edit and add new windows a new box will show with the fields defined. Each field added will be saved in the WordPress Database as a custom field, so that you can take advantage of the standard WordPress query rules to list your content on the page template. Not only can you create and manage new post types but you can create and manage custom fields and meta boxes associated with a particular post type. It comes with a built-in date picker field to help with post types that are date-specific. Another key feature giving this plugin loads of potential is that it allows you manage the admin display of your created post types. For instance, if you wanted a custom field to show up in the posts list screen, you can do that.

Post Type Switcher
http://wordpress.org/…pe-switcher/

A simple way to change a post type in WordPress (one at a time). Any combination is possible, even custom post types.

  • Page to Post
  • Post to Page
  • Post to Custom
  • Post to revision/attachmen­t/navigation menu is possible but turned off by default

Convert Post Types
http://wordpress.org/…-post-types/

This is a utility for converting lots of posts or pages to a custom post type (or vice versa). You can limit the conversion to posts in a single category or children of specific page. You can also assign new taxonomy terms, which will be added to the posts' existing terms.

Další informace:

A WordPress forum plugin using custom post types
The Essential Guide to WordPress 3.0 Custom Taxonomies

First Impressions of Custom Post Type
Function Reference/register post type
Custom Post Types in WordPress 2.9
How To Make WordPress An CMS With Different Post Types
Developing Post Types Plugin with WordPress
How to Set Up Custom WordPress Category Templates
Creating single post templates in WordPress
WordPress Single Post Templates