That's my situation right now:
I want to display my "Artist" custom field under the "Slug" field, with the same HTML structure. But how? Example:
The following code may help:
// Display the custom field
function my_custom_field_add_quick_edit($column_name, $post_type)
{
if ($column_name != 'Artista')
return;
global $post;
$custom_field_value = get_post_meta($post->ID, 'Artista', true);
?>
<fieldset class="inline-edit-col-right">
<div class="inline-edit-group">
<label>
<span class="title">Artista</span>
<input type="text" name="Artista" value="<?php echo esc_attr($custom_field_value); ?>" />
</label>
</div>
</fieldset>
<?php
}
add_action('quick_edit_custom_box', 'my_custom_field_add_quick_edit', 10, 2);
// Display the original fields
<fieldset class="inline-edit-col-left">
<legend class="inline-edit-legend" id="<?php echo $bulk ? 'bulk' : 'quick'; ?>-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
<div class="inline-edit-col">
<?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?>
<?php if ( $bulk ) : ?>
<div id="bulk-title-div">
<div id="bulk-titles"></div>
</div>
<?php else : // $bulk ?>
<label>
<span class="title"><?php _e( 'Title' ); ?></span>
<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
</label>
<?php if ( is_post_type_viewable( $screen->post_type ) ) : ?>
<label>
<span class="title"><?php _e( 'Slug' ); ?></span>
<span class="input-text-wrap"><input type="text" name="post_name" value="" autocomplete="off" spellcheck="false" /></span>
</label>
<?php endif; // is_post_type_viewable() ?>
<?php endif; // $bulk ?>
<?php endif; // post_type_supports( ... 'title' ) ?>
</div>
</fieldset>
Thanks in advance. And don't be rude. I'm new to PHP.
my_custom_blahblahblah
... ....change that to something unique to your site. I normally have a prefix that I use across an entire theme or plugin and just use that ie.gutsa_field_add_quick_edit()
.<fieldset class="inline-edit-col-right">
and the closing</fieldset>
tags for your custom field... ...see if that does it. Either way, I think if you just work through the CSS you'll find the issue pretty quick.