Support » Plugins » need to order the Admin > Edit Post list by custom field value

  • I’m using Custom_post_type to ‘events’ to my WordPress and I’m using this code to add extra columns to the Edit Events list

    add_action("manage_posts_custom_column", "events_custom_columns");
    add_filter("manage_edit-events_columns", "events_edit_columns");
    
    function events_edit_columns($columns)
    {
    	$columns = array(
    		"cb" => "<input type=\"checkbox\" />",
    		"title" => "Title",
    		"Date" => "Event Date",
    		"description" => "Description"
    	);
    	return $columns;
    }
    
    function events_custom_columns($column)
    {
    	global $post;
    	if ("ID" == $column) echo $post->ID;
    	elseif ("description" == $column) echo $post->post_content;
    	elseif ("Date" == $column) echo get_post_meta($post->ID, 'Date', true);
    }

    I would like to order the list by my ‘Date’ custom field, is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘need to order the Admin > Edit Post list by custom field value’ is closed to new replies.