WordPress.org

Plugin Directory

Changeset 555964


Ignore:
Timestamp:
06/11/12 05:35:01 (22 months ago)
Author:
JarretC
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • media-library-alt-fields/trunk/mlaf-plugin.php

    r555916 r555964  
    4040} 
    4141 
    42 function mlaf_field_input( $column, $post_id ) { 
     42add_action( 'manage_media_custom_column', 'mlaf_field_input' ); 
     43add_filter( 'manage_media_columns', 'mlaf_display_column' ); 
     44 
     45function mlaf_field_input( $column ) { 
    4346    // Set inputs to display in column 
     47    if ( $column == 'mlaf-column' ) { 
     48    global $post; 
    4449    ?> 
    45     <div class="altwrapper" id="wrapper-<?php echo $post_id; ?>"> 
    46         <input type="text" id="alt-<?php echo $post_id; ?>" value="<?php echo wp_strip_all_tags( get_post_meta( $post_id, '_wp_attachment_image_alt', true ) ); ?>" /> 
    47         <input type="button" id="pid-<?php echo $post_id; ?>" value="Save" class="button-primary mlaf-update" style="width: 30px;" /> 
     50    <div class="altwrapper" id="wrapper-<?php echo $post->ID; ?>"> 
     51        <input type="text" id="alt-<?php echo $post->ID; ?>" value="<?php echo wp_strip_all_tags( get_post_meta( $post->ID, '_wp_attachment_image_alt', true ) ); ?>" /> 
     52        <input type="button" id="pid-<?php echo $post->ID; ?>" value="Save" class="button-primary mlaf-update" style="width: 30px;" /> 
    4853        <img class="waiting" style="display: none" src="<?php echo esc_url( admin_url( "images/wpspin_light.gif" ) ); ?>" /> 
    4954    </div> 
    5055    <?php 
    5156} 
    52 add_action( 'manage_media_custom_column', 'mlaf_field_input', 10, 2 ); 
     57} 
    5358 
    5459function mlaf_display_column( $columns ) { 
    5560    // Register the column to display 
    56     return array_merge( $columns, 
    57             array( 'alt' => __( 'Image Alt Text' ) ) ); 
     61    $columns['mlaf-column'] = 'Image Alt Text'; 
     62    return $columns; 
     63    //return array_merge( $columns, 
     64            //array( 'alt' => __( 'Image Alt Text' ) ) ); 
    5865} 
    59 add_filter( 'manage_media_columns', 'mlaf_display_column' ); 
    6066 
    6167add_action( 'wp_ajax_mlaf_alt_update' , 'mlaf_alt_update' ); 
Note: See TracChangeset for help on using the changeset viewer.