inline_edit_row

Definition:
function inline_edit_row( $screen ) {}

Outputs the quick edit and bulk edit table rows for posts and pages

Parameters

  • string $screen

Defined filters

  • quick_edit_dropdown_pages_args
    apply_filters('quick_edit_dropdown_pages_args', $dropdown_args)

Defined actions

  • $bulk?’bulk_edit_custom_box’:’quick_edit_custom_box
    do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );

Source code

function inline_edit_row( $screen ) {

	global $mode;



	if ( is_string($screen) ) {

		$screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );

		$screen = (object) $screen;

	}



	$post = get_default_post_to_edit( $screen->post_type );

	$post_type_object = get_post_type_object( $screen->post_type );



	$taxonomy_names = get_object_taxonomies( $screen->post_type );

	$hierarchical_taxonomies = array();

	$flat_taxonomies = array();

	foreach ( $taxonomy_names as $taxonomy_name ) {

		$taxonomy = get_taxonomy( $taxonomy_name);



		if ( !$taxonomy->show_ui )

			continue;



		if ( $taxonomy->hierarchical )

			$hierarchical_taxonomies[] = $taxonomy;

		else

			$flat_taxonomies[] = $taxonomy;

	}



	$columns = wp_manage_posts_columns($screen);

	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );

	$col_count = count($columns) - count($hidden);

	$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';

	$can_publish = current_user_can($post_type_object->cap->publish_posts);

	$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );



?>



<form method="get" action=""><table style="display: none"><tbody id="inlineedit">

	<?php

	$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';

	$bulk = 0;

	while ( $bulk < 2 ) { ?>



	<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";

		echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";

	?>" style="display: none"><td colspan="<?php echo $col_count; ?>">



	<fieldset class="inline-edit-col-left"><div class="inline-edit-col">

		<h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>





<?php



if ( post_type_supports( $screen->post_type, 'title' ) ) :

	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>



		<label>

			<span class="title"><?php _e( 'Slug' ); ?></span>

			<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>

		</label>



<?php endif; // $bulk

endif; // post_type_supports title ?>



<?php if ( !$bulk ) : ?>

		<label><span class="title"><?php _e( 'Date' ); ?></span></label>

		<div class="inline-edit-date">

			<?php touch_time(1, 1, 4, 1); ?>

		</div>

		<br class="clear" />



<?php endif; // $bulk



	if ( post_type_supports( $screen->post_type, 'author' ) ) :

		$authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM

		$authors_dropdown = '';

		if ( $authors && count( $authors ) > 1 ) :

			$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);

			if ( $bulk )

				$users_opt['show_option_none'] = __('&mdash; No Change &mdash;');

			$authors_dropdown  = '<label>';

			$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';

			$authors_dropdown .= wp_dropdown_users( $users_opt );

			$authors_dropdown .= '</label>';



		endif; // authors

?>



<?php if ( !$bulk ) echo $authors_dropdown;

endif; // post_type_supports author



if ( !$bulk ) :

?>



		<div class="inline-edit-group">

			<label class="alignleft">

				<span class="title"><?php _e( 'Password' ); ?></span>

				<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>

			</label>



			<em style="margin:5px 10px 0 0" class="alignleft">

				<?php

				/* translators: Between password field and private checkbox on post quick edit interface */

				echo __( '&ndash;OR&ndash;' );

				?>

			</em>

			<label class="alignleft inline-edit-private">

				<input type="checkbox" name="keep_private" value="private" />

				<span class="checkbox-title"><?php echo __('Private'); ?></span>

			</label>

		</div>



<?php endif; ?>



	</div></fieldset>



<?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?>



	<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">



<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>



		<span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?>

			<span class="catshow"><?php _e('[more]'); ?></span>

			<span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>

		</span>

		<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?>" value="0" />

		<ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">

			<?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?>

		</ul>



<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>



	</div></fieldset>



<?php endif; // count($hierarchical_taxonomies) && !$bulk ?>



	<fieldset class="inline-edit-col-right"><div class="inline-edit-col">



<?php

	if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )

		echo $authors_dropdown;

?>



<?php if ( $post_type_object->hierarchical ) : ?>



		<label>

			<span class="title"><?php _e( 'Parent' ); ?></span>

<?php

	$dropdown_args = array('post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');

	if ( $bulk )

		$dropdown_args['show_option_no_change'] =  __('&mdash; No Change &mdash;');

	$dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);

	wp_dropdown_pages($dropdown_args);

?>

		</label>



<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :

		if ( !$bulk ) : ?>



		<label>

			<span class="title"><?php _e( 'Order' ); ?></span>

			<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>

		</label>



<?php	endif; // !$bulk ?>



		<label>

			<span class="title"><?php _e( 'Template' ); ?></span>

			<select name="page_template">

<?php	if ( $bulk ) : ?>

				<option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>

<?php	endif; // $bulk ?>

				<option value="default"><?php _e( 'Default Template' ); ?></option>

				<?php page_template_dropdown() ?>

			</select>

		</label>



<?php

	endif; // post_type_supports page-attributes

endif; // $post_type_object->hierarchical ?>



<?php if ( count($flat_taxonomies) && !$bulk ) : ?>



<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>



		<label class="inline-edit-tags">

			<span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span>

			<textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>

		</label>



<?php endforeach; //$flat_taxonomies as $taxonomy ?>



<?php endif; // count($flat_taxonomies) && !$bulk  ?>



<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :

	if ( $bulk ) : ?>



		<div class="inline-edit-group">

	<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>

		<label class="alignleft">

			<span class="title"><?php _e( 'Comments' ); ?></span>

			<select name="comment_status">

				<option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>

				<option value="open"><?php _e('Allow'); ?></option>

				<option value="closed"><?php _e('Do not allow'); ?></option>

			</select>

		</label>

	<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>

		<label class="alignright">

			<span class="title"><?php _e( 'Pings' ); ?></span>

			<select name="ping_status">

				<option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>

				<option value="open"><?php _e('Allow'); ?></option>

				<option value="closed"><?php _e('Do not allow'); ?></option>

			</select>

		</label>

	<?php endif; ?>

		</div>



<?php else : // $bulk ?>



		<div class="inline-edit-group">

		<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>

			<label class="alignleft">

				<input type="checkbox" name="comment_status" value="open" />

				<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>

			</label>

		<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>

			<label class="alignleft">

				<input type="checkbox" name="ping_status" value="open" />

				<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>

			</label>

		<?php endif; ?>

		</div>



<?php endif; // $bulk

endif; // post_type_supports comments or pings ?>



		<div class="inline-edit-group">

			<label class="inline-edit-status alignleft">

				<span class="title"><?php _e( 'Status' ); ?></span>

				<select name="_status">

<?php if ( $bulk ) : ?>

					<option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>

<?php endif; // $bulk ?>

				<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>

					<option value="publish"><?php _e( 'Published' ); ?></option>

					<option value="future"><?php _e( 'Scheduled' ); ?></option>

<?php if ( $bulk ) : ?>

					<option value="private"><?php _e('Private') ?></option>

<?php endif; // $bulk ?>

				<?php endif; ?>

					<option value="pending"><?php _e( 'Pending Review' ); ?></option>

					<option value="draft"><?php _e( 'Draft' ); ?></option>

				</select>

			</label>



<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>



<?php	if ( $bulk ) : ?>



			<label class="alignright">

				<span class="title"><?php _e( 'Sticky' ); ?></span>

				<select name="sticky">

					<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>

					<option value="sticky"><?php _e( 'Sticky' ); ?></option>

					<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>

				</select>

			</label>



<?php	else : // $bulk ?>



			<label class="alignleft">

				<input type="checkbox" name="sticky" value="sticky" />

				<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>

			</label>



<?php	endif; // $bulk ?>



<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?>



		</div>



	</div></fieldset>



<?php

	foreach ( $columns as $column_name => $column_display_name ) {

		if ( isset( $core_columns[$column_name] ) )

			continue;

		do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );

	}

?>

	<p class="submit inline-edit-save">

		<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>

		<?php if ( ! $bulk ) {

			wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );

			$update_text = __( 'Update' );

			?>

			<a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>

			<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

		<?php } else {

			$update_text = __( 'Update' );

		?>

			<input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />

		<?php } ?>

		<input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?>" />

		<input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?>" />

		<br class="clear" />

	</p>

	</td></tr>

<?php

	$bulk++;

	} ?>

	</tbody></table></form>

<?php

}

2015

No comments yet... Be the first to leave a reply!

Leave a comment