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 »

Rychlá nebo hromadná editace uživatelských polí

Saving custom fields in quick or bulk edit mode in WordPress
http://wpdreamer.com/…-quick-edit/

One of the most cool features when managing WordPress posts, is the ability to batch edit multiple posts at once or quickly edit one post to perform a simple task such as adding a tag. Learn how to extend WordPress’ Quick Edit and Bulk Edit to retrieve and save the value of your custom fields.

Plugin Custom Bulk/Quick Edit
http://wordpress.org/…kquick-edit/
https://github.com/…lkquick-edit
How do I add custom fields to my bulk/quick edit page »
How do you configure options »

Pozor, do functions.php může být nutné přidat:

add_filter( 'manage_post_posts_columns', 'my_manage_post_posts_columns' );
function my_manage_post_posts_columns( $columns ) {
        $columns['custom_field_name'] = esc_html__( 'Nazev sloupce v administraci' ); // pozor, název sloupce musí být bez diakritiky
        return $columns;
}

a teprve po přidání tohoto kódu je třeba zpřístupnit pole v nastavení pluginu.

Používání uživatelských polí v šablonách

Using Custom Fields In Your WordPress Template »

// key = název (klíč) uživatelského pole
// $post->ID lze použít pouze v loopu
if($data = get_post_meta($post->ID, 'key', true)) {
    echo $data;
}

// v případě pole
if($data = get_post_meta($post->ID, 'key')) {
    echo $data[0];
    echo $data[1];
}

Detailed example for the usage of the add_post_meta, delete_post_meta, update_post_meta, and get_post_meta functions.

Správa uživatelských polí vč. vytváření metaboxů

Advanced Custom Fields
http://wordpress.org/…stom-fields/
http://www.advancedcustomfields.com/

  • Visually create your Fields
  • Select from multiple input types (text, textarea, wysiwyg, image, file, page link, post object, relationship, select, checkbox, radio buttons, date picker, true / false, repeater, flexible content, gallery and more to come!)
  • Assign your fields to multiple edit pages (via custom location rules)

Handy add-on:

Advanced Custom Fields Limiter
https://wordpress.org/…lds-limiter/

Insert JavaScript character limiters in Advanced Custom Fields. You set a limit for each field, and a character counter will appear next to them in the admin interface. " A lot of other ACF extending plugins available »":http://wordpress.org/…s/search.php?…

Jak přidat vlastní pole do uživatelského profilu a zobrazit je na stránce

This technique will allow you to easily add new user profile fields that your blog’s users can use to input more information about themselves. In this tutorial, I’ll show you how to add an input box for a Twitter username and how to display it on your site.

In this article we will show you how you can create a contributors page which will display a list of authors with avatars or userphoto and any other information that you like.

The user profile of WordPress can be fairly easily adapted to add your own values​​. So you can add the necessary custom fields according to your requirements. Here is how you do it.

Most free themes do not have a custom author.php file, WordPress automatically callback to archive.php or index.php when someone views the author profile page. The problem with that is that it will only list all the posts written by the author, and it provides no personal information about the author. It is recommended that you copy your archive.php and save it as author.php and modify it.

To get user's (author's) data from his/her profile, use get_userdata function:

<?php
      $user_info = get_userdata($userid);
      $first_name = $user_info->first_name;
      $last_name = $user_info->last_name;
      $email = $user_info->user_email;
      $description = $user_info->description;
      $roles = $user_info->roles;
      $username = $user_info->user_login;
?>

obdobně funkce get user by.

Jednoduché přidání vlastních vstupních polí

Plugin vhodný spíše pro mírně pokročilejší uživatele WordPressu umožní vytvoření vlastních vstupních polí (nastavitelná alternativa uživatelských polí - custom fields) k článkům a stránkám. Podoba vytvořených vstupních polí pro vkládání určených hodnot je v podstatě libovolná, samozřejmě v závislosti na vašich potřebách a nastaveních v administraci pluginu (Nastavení - Simple Fields). Můžete si vždy pro [...]

Pohodlné vytváření uživatelských polí

Verve Meta Boxes
http://wordpress.org/…-meta-boxes/
http://www.avenueverve.com/…-meta-boxes/

Verve Meta Boxes is a robust custom fields plugin with an intuitive, polished interface that allows for creation of text, textarea, image, file, date, select, radio, and checkbox custom fields for posts and/or pages.

Values for custom fields are stored in wp_postmeta and can be accessed in templates through standard WordPress functions such as: the_meta, get_post_meta, get_post_custom, get_post_custom_va­lues, etc.

Alternativy

Advanced Custom Fields
http://wordpress.org/…stom-fields/

Fully customise WordPress edit screens with powerful fields.

  • Visually create your Fields
  • Select from multiple input types (text, textarea, wysiwyg, image, file, page link, post object, relationship, select, checkbox, radio buttons, date picker, true / false, repeater, flexible content, gallery and more to come!)
  • Assign your fields to multiple edit pages (via custom location rules)
  • Easily load data through a simple and friendly API
  • Uses the native WordPress custom post type for ease of use and fast processing
  • Uses the native WordPress metadata for ease of use and fast processing

Using ACF in templates:

get_field('fi­eld_name') - returns the value
the_field('fi­eld_name') - displays the value

Automated Exporting for Advanced Custom Fields »
A way to make Advanced Custom Fields automatically export all fields to a PHP file. Export is initiated whenever an admin publishes a new field group or saves changes to an existing field group.

Programmatically define custom fields, prevent custom field changes or deletion »

Adding Sortable Columns to WP_List_Table

Using the Advanced Custom Fields Plugin to create a custom home page in WordPress »

Vytváření uživatelských polí v administračním rozhraní

Flutter
http://wordpress.org/…/fresh-page/
http://flutter.freshout.us/

Flutter is a feature rich WordPress CMS plugin that focuses on easy templating for the developer and simplifies content management for the admin by creating custom write panels that can be fully customized (radio buttons, file uploads, image uploads, checkboxes, etc).

Flutter also includes power image manipulation (automatic resizing, cropping, watermarking, etc), edit in place (works instantly!), and modulation of your themes.