Title: Manually Adding Admin Columns to Custom Post Type
Last modified: August 31, 2016

---

# Manually Adding Admin Columns to Custom Post Type

 *  [poopsplat](https://wordpress.org/support/users/poopsplat/)
 * (@poopsplat)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/manually-adding-admin-columns-to-custom-post-type/)
 * I am using your plugin to get feedback from a custom post type, and I am having
   trouble adding the ratings columns to the admin table for the post type, as it
   doesn’t seem to just show up automatically (maybe because I am already adding
   custom tables to it?).
 * The custom post type is registered and then I am adding custom columns with the
   following:
 *     ```
       // Custom admin columns for post type
       function edit_columns($columns){
         $columns = array(
           'cb' => '<input type="checkbox" />',
           'title' => 'Question',
           'content' => 'Answer',
           'taxonomy-faq_cat' => 'Category'
         );
         return $columns;
       }
       add_filter('manage_faq_posts_columns', __NAMESPACE__ . '\edit_columns');
       ```
   
 * I tried to add the ratings columns manually with the follow:
 *     ```
       // Custom admin columns for post type
       function edit_columns($columns){
         global $post;
         $upvotes = thumbs_rating_show_up_votes($post->ID);
         $downvotes = thumbs_rating_show_down_votes($post->ID);
         $columns = array(
           'cb' => '<input type="checkbox" />',
           'title' => 'Question',
           'content' => 'Answer',
           'taxonomy-faq_cat' => 'Category',
           $upvotes = 'Upvotes',
           $downvotes = 'Downvotes',
         );
         return $columns;
       }
       add_filter('manage_faq_posts_columns', __NAMESPACE__ . '\edit_columns');
       ```
   
 * But it had a weird effect: it shows the upvotes count + the content of the post,
   and leaves the downvotes blank: [http://d.pr/i/qZLC](http://d.pr/i/qZLC)
    As 
   well, if you look at the screen options for the post type in the admin, it shows
   the Downvotes as an option, but not the Upvotes… [http://d.pr/i/6fnv](http://d.pr/i/6fnv)
 * Any thoughts here?
    Thanks! Matt
 * [https://wordpress.org/plugins/thumbs-rating/](https://wordpress.org/plugins/thumbs-rating/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Ricard Torres](https://wordpress.org/support/users/quicoto/)
 * (@quicoto)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/manually-adding-admin-columns-to-custom-post-type/#post-7366548)
 * Hey there,
 * Great question. I have no idea 🙂
 * I can barely remember how I did it for the columns.
 * Maybe first try to print just plain text, no actual values. Once that is working
   try pulling the votes.

Viewing 1 replies (of 1 total)

The topic ‘Manually Adding Admin Columns to Custom Post Type’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/thumbs-rating_d1a77d.svg)
 * [Thumbs Rating](https://wordpress.org/plugins/thumbs-rating/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thumbs-rating/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thumbs-rating/)
 * [Active Topics](https://wordpress.org/support/plugin/thumbs-rating/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thumbs-rating/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thumbs-rating/reviews/)

## Tags

 * [admin columns](https://wordpress.org/support/topic-tag/admin-columns/)
 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ricard Torres](https://wordpress.org/support/users/quicoto/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/manually-adding-admin-columns-to-custom-post-type/#post-7366548)
 * Status: not a support question