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.

Possible Duplicate: How to show custom meta box on "Quick Edit" screen?

I'm trying to edit the quick edit screen on my custom post type "visitor" so that I can add some options for my end-users. My custom post type doesn't require/need a post date, password to view, publish status, or large taxonomy boxes for custom categories of visitors on it.

I've already added a custom meta box for the actual edit page, but would like to enable quick-edit support of those post meta fields while disabling the current quick-edit options.

I also found a post (linked in my possible duplicate) over on wordpress.org's forums, but not sure exactly what it does.

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be very difficult to find info on how to do it. You have to really dig through the source to find it too.

Add Form fields to Quick Edit

<?php
add_action('quick_edit_custom_box', 'quickedit_posts_custom_box', 10, 2);
add_action('admin_head-edit.php', 'quick_add_script');

function quickedit_posts_custom_box( $col, $type ) {
    if( $col != 'COLUMN_NAME' || $type != 'post' ) {
        return;
    } ?>
    <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
        <div class="inline-edit-group">
            <label class="alignleft">
                <input type="checkbox" name="yourformfield" id="yourformfield_check">
                <span class="checkbox-title">This Post Has Cake</span>
            </label>
        </div>
    </fieldset>
    <?php
}

function quick_add_script() { ?>
    <script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('a.editinline').live('click', function() {
            var id = inlineEditPost.getId(this);
            var val = parseInt(jQuery('#inline_' + id + '_yourformfield').text());
            jQuery('#yourformfield_check').attr('checked', !!val);
        });
    });
    </script>
    <?php
}
share|improve this answer
1  
I have read this, but i dont understand; how it is possible to set the checkbox, if the post meta data is on database; get_meta_data() is only usable in php; maybe you have an hint or solution for me. Current is your example nice, but i dont understand the ID #inline_' + id + '_yourformfield; where is this; and is th ID global from WP. I have add many checkboxes and als works fine to save the data, but i dont find a solution for see the checked checkbox. Many thanks! –  bueltge Oct 10 '11 at 13:48
add comment

I'm doing a bit of tooting my own horn here, but to make editing custom meta fields in WordPress easier, I wrote a plugin called Custom Bulk/Quick Edit.

This plugin not only adds the custom meta to the Bulk and Quick Edit screens for actual editing, but also as columns to the post type listing.

Then, incase the theme or plugin in use hadn't already enabled the custom meta to the post type columns, you can use a filter to add your columns.

In your theme's functions.php file add code similar to the following.

add_filter( 'manage_post_posts_columns', 'my_manage_post_posts_columns' );
function my_manage_post_posts_columns( $columns ) {
$columns['custom_stuff'] = esc_html__( 'Custom Stuff Here' );

return $columns;
}

As an example of working with a custom post type named news-room, try the following.

add_filter( 'manage_news-room_posts_columns', 'my_manage_newsroom_posts_columns' );
function my_manage_newsroom_posts_columns( $columns ) {
$columns['wpcf-publication-author'] = esc_html__( 'Publication Author');
$columns['wpcf-newsroom-type']      = esc_html__( 'News Room Type');
$columns['_views_template']         = esc_html__( 'Content Template');

return $columns;
}

This is based upon the filter manage_${post_type}_posts_columns for the post post type.

Please note that to help further development and support, the free plugin is limited to WordPress's own built-in post types. If you're working with a custom post type, you can purchase Custom Bulk/Quick Edit Premium.

Alternately, you're welcome to extract code out of the plugin via https://github.com/michael-cannon/custom-bulkquick-edit.

share|improve this answer
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.