Tell me more ×
WordPress Answers 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

1 Answer

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
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

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.