Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I wonder if WordPress gives me the ability to add 2 fields (input and textarea) in the Quick Edits of Tags.

Actually these 2 fields I want to add in Quick Edit which are available in Edit Tag page, but I want to display these 2 fields in Quick Edit so I'll able to access them easily.

Please check image to get more idea:

Is there any way to do this?

share|improve this question
    
If you do a search for quick edit there's already several topics that give you some good information about this. Possible dupe –  Zach Nov 1 '12 at 19:41
    
thank you for you response, but I had already checked and it seems the people miss here this issue related to me. –  Muzzy Nov 1 '12 at 20:54
add comment

1 Answer

A small example from my last project. The important part is the hook quick_edit_custom_box. On this hook can you add your form elements. The second important part is to add your script that update the data via javascript. The script in this example was add to the head in edit.php; it is better on footer and you must check the right page.

The example source below is inside a class, please note this.

add_action( 'quick_edit_custom_box', array( $this, 'add_quick_edit' ), 10, 2 );
add_action( 'admin_head-edit.php',   array( $this, 'quick_add_script' ) );

/**
 * Add data to quick edit on list post and page
 * 
 * @since   0.0.1
 * @access  public
 * @uses    wp_nonce_field, plugin_basename, get_plw123mh_hosts, esc_url_raw, _e
 * @param   string array $column_name
 * @param   string $post_type
 * @return  string
 */
public function add_quick_edit ( $column_name, $post_type ) {

    if ( 'multihosts' != $column_name )
        return;

    // Use nonce for verification
    wp_nonce_field( plugin_basename( __FILE__ ), self :: get_textdomain() . '_nonce' );

    $hostlist = $this -> get_plw123mh_hosts();

    $checkboxes = '';
    while( list($key, $val) = each($hostlist) ) {
        if( '' != $val ) {
            $val_e  = esc_url_raw($val);
            $val    = '_' . str_replace( '.', '_', trim( strtolower($val_e) ) );
            /*
            $data   = get_post_meta( $post->ID, $val , TRUE );

            if ( 1 == $data || '' === $data )
                $checked = ' checked="checked"';
            else 
            */
                $checked = '';

            $checkboxes .= '<label class="alignleft"><input type="checkbox" id="' 
            . $val . '_check" name="' . $val 
            . '" value="1"' . $checked . '/><span class="checkbox-title"> ' . $val_e . '</span></label>' . "\n";
        }
    }

    ?>
    <fieldset class="inline-edit-col-left">
        <div class="inline-edit-col">
            <span class="title"><?php _e( 'Multihosts', self :: get_textdomain() ); ?></span>
            <div class="inline-edit-group">
    <?php
    echo $checkboxes;
    ?>
            </div>
        </div>
    </fieldset>
    <?php
}

    public function quick_add_script () {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $('a.editinline').live('click', function() {
            var id = inlineEditPost.getId(this);
            var val = parseInt( $('#inline_' + id + '_http://localhost').text() );
            $('#_http://localhost_check').attr('checked', !!val);
        });
    });
    </script>
    <?php
}

see also this answer WPSE 7291 for a example. Also more hints inlcude bulk in this answer WPSE 3316.

Last hint: You can also save the data via hook `edit_post'. Also a small example, write from scratch.

add_action( 'edit_post', array( $this, 'quick_edit_save' ), 10, 3 );
function ilc_quickedit_save($post_id, $post) {

    if ( $post->post_type !== 'event' )
        return;

    if ( isset( $_POST['is_quickedit'] ) )
        update_post_meta( $post_id, 'eventdate', esc_attr( $_POST['eventdate'] ) );
}
share|improve this answer
    
Sorry to say, i have tried all these ways and still stuck. my problem is that i want to use "Edit" > "Edit Tag" page 2 fields which are "Archive Headline", "Archive Intro Text" –  Muzzy Nov 1 '12 at 22:07
1  
The tags use the same hook, but more params: do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); –  bueltge Nov 1 '12 at 22:27
    
Frank, I read this comment by you on a similar answer. How exactly do you get post meta data in the quick edit mark up? Can't imagine something after a brief look. –  kaiser Sep 30 '13 at 12:49
    
Since this post I haven't build a solution on quick edit. I'm not sure, that it works. I think, that I used this post as helper. Important is the crazy javascript part. –  bueltge Oct 1 '13 at 15:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.