1

I'm trying to add the value of a custom field under the post/page title in wp-admin list of posts/pages (much like excerpt mode in posts list) without hooking into the columns process since other plugins are already doing that and it looks like each cancels the other.

Here's a screenshot of what I'm trying to achieve:

screenshot of pages list

Thanks!

  • Would you settle for adding another column with this data? – Brian Fegter Feb 23 '12 at 17:03
  • @BrianFegter thanks, but that's something I was able to do! – Amit Feb 23 '12 at 17:36
2

Just like you add new columns you render the title filed your self

add_action( 'manage_posts_custom_column', 'admin_post_data_row', 10, 2);
function admin_post_data_row($column_name, $post_id)
{
    switch($column_name){
        case 'title':       
            edit_post_link(get_post_title($post_id), '<p>', '</p>',$post_id);
            echo '<br />'.get_post_meta($post_id,'field_name',true);
            break;
        default:
            break;
    }
}

and if you have another plugin cancels this then simply set the filter hook priority to something bigger.

  • @Amit eyn al maa :) – Bainternet Feb 24 '12 at 19:46
1

You can hook into the post_row_actions as follows:

add_filter('post_row_actions', 'wpse_43281_post_row_actions', 10, 2);
function wpse_43281_post_row_actions($actions, $post){
    $meta_value = get_post_meta($post->ID, 'key', true);
    $actions[] = "Meta Value: $meta_value"; //This will add to the hidden hover list
    echo $meta_value; //This will display below the post title 
    return $actions; //Important!
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.