[wp-hackers] Sorting by column value
Dmitry Tokmakov
dmitry at getmoxied.net
Mon Mar 26 16:33:28 UTC 2012
Hi everyone,
Short description of my problem:
I have a custom post type called "press_articles",
With the code below I have created custom column, with the custom value.
add_filter('manage_press_articles_posts_columns' , 'add_press_articles_columns');
add_action( 'manage_press_articles_posts_custom_column','custom_columns', 10, 2 );
function custom_columns( $column, $post_id ) {
switch ( $column ) {
case 'featured_article':
$featured_flag = get_post_meta($post_id,'dt_featured_press_radio', true);
if ( is_string( $featured_flag ) ) {
echo $featured_flag;
} else {
echo 'Unable to get value';
}
break;
}
}
Everything is working fine,
but sorting by column is not.
Any ideas on how implement sorting by column value ?
like when you go to your posts and click by header of date column to sort your posts by date.
Thanks,
Dmitry
More information about the wp-hackers
mailing list