WordPress.org

Ready to get started?Download WordPress

Forums

Add a field to Quick Edit (3 posts)

  1. Elio Rivero
    Member
    Posted 3 years ago #

    Hi there, I've been trying to add a field to Quick Edit mode for posts but reached a dead end. The extra field is displayed using:

    add_action('quick_edit_custom_box', 'ilc_quickedit_show', 10, 2);
    function ilc_quickedit_show( $col, $type ) {
    	if( $type != 'event' ) return; ?>
    
    	<fieldset class="inline-edit-col-left">
    		<div class="inline-edit-col">
    			<div class="inline-edit-group">
    				<label for="eventdate" style="font: italic 12px Georgia, serif;">Event Date</label>
    				<span class="input-text-wrap">
    					<input type="text" name="eventdate" id="eventdate" size="10" value="">
    				</span>
    			</div>
    		</div>
    	</fieldset>
    
    	<?php
    }

    and even entered values are saved using:

    add_action('save_post','ilc_quickedit_save',10,3);
    function ilc_quickedit_save($post_id, $post) {
    	if( $post->post_type != 'event' ) return;
    	update_post_meta($post_id, 'Event Date', $_POST['eventdate']);
    }

    As you surely noticed, this is for a custom post type 'event'. However, I can't retrieve the values and populate the fields. AFAIK, this involves inline-edit-post.js but I can't find any way to use inlineEditPost to retrieve the custom field value. Even the post id is available in the JavaScript scope

    add_action('admin_head-edit.php', 'ilc_quickedit_get');
    function ilc_quickedit_get() { ?>
        <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery('a.editinline').live('click', function() {
                var id = inlineEditPost.getId(this);
                alert("Post id: " + id);
            });
        });
        </script>
        <?php
    }

    But, no luck for retrieving the values.

  2. C450104
    Member
    Posted 2 years ago #

    I know this is really late in coming, but did you figure it out or find a tutorial like this one already?

    http://shibashake.com/wordpress-theme/expand-the-wordpress-quick-edit-menu

  3. Elio Rivero
    Member
    Posted 2 years ago #

    Couldn't find anything on the topic, specially for the bulk edit mode. Had to dig deep into WP core and got it working. In the end I wrote a tutorial depicting how to save values not only in Quick Edit but also on Bulk Edit mode.
    http://ilovecolors.com.ar/saving-custom-fields-quick-bulk-edit-wordpress/

Topic Closed

This topic has been closed to new replies.

About this Topic