php - Displayin custom taxonomies in custom post type columns -


I have seen many posts about adding custom carbonos in CPT columns; I say that besides showing taxonomies (publication), I am capable of doing all the work. Here is my CPT code:

  add_action ('init', 'pb_custom_post_type'); Function pb_custom_post_type () {$ labels = array ( 'name' = & gt; _x ( 'press',' post type generic name '),' singular_name '= & gt; _x (' press' Post type singular name ' ), 'Add_new' = & gt; _x ( 'Add new', 'review'), 'add_new_item' = & gt; __ ( 'Add new press'),' edit_item '= & gt; __ (' edit Press ), 'Nya_aitm' = & Gt; __ ( 'new Press), "Sbi_itm' = & gt; __ ( 'the press'), 'Drishy_aitm' = & gt; __ ( 'Views Press'), 'Khoj_tms' = & Gt; __ ('search press',' no_found '=> (no' press no '),' not_found_in_trash '= & gt; __ (' no press found in the garbage '),' Arguments = array ('labels' = & gt; $ labels,' description '= & gt;' press notifications'); $ Args = array ('parent_tem_colan' = 'gt;' ',' menu_name '= & gt; ',' Public '= & gt; true,' menu_position '=> 20,' support '=> array (' title ',' editor ',' thumbnail '),' has_archive '= & gt; true is,); Register_post_type ( 'Press', $ Arges);} Add_filter ( 'manage_edit-press_columns', 'my_edit_press_columns'); function my_edit_press_columns ($ column) {$ columns = array ( 'cb' = & gt; '& Lt; Input type = "checkbox" />, 'title' = & gt; __ ('title'), 'publication' = & gt; __ ('publication'), 'date' = & gt; __ ('date')); Return $ column; }  

Custom classification

  add_action ('init', 'create_my_taxonomies', 0); False, 'rewrite' = & gt; Bnavt_man_taksonomij function () {register_taxonomy ( 'publication', 'Press', array ( 'hierarchical' = & gt; wrong, 'label' = & gt; 'Publications', 'query_var' = & gt;)); }  

Now I have seen two different options, either trying to add show_ui / show_admin_column to classification arguments, or another function with switch statement I have both below Have tried, am I missing something important?

1

  add_action ('init', 'create_my_taxonomies', 0); Create function_m_taxenomie () {$ args = array ('show_ui' = & gt; true, 'show_admin_column' = & gt; true); Rjistr_takkomori ( 'publication', 'Press', array (= 'hierarchical' & gt; wrong, 'label' = & gt; 'Publications', 'query_var' = & gt; wrong, 'Rewrite' = & gt; true ), $ Args); } ( $ column, $ post_id} {switch ($ column) {case "publication": echo get_post_meta ($ post_id)  

2

 

'Publication', true); break; }} Add_action ("manage_posts_custom_column", "custom_columns", 10, 2);

Remove your custom column function, and 'show_admin_column' = & gt; Actual arguments for 'show_admin_column' = & gt; 'hierarchical' = & gt; Wrong, 'label' = & gt; 'publication', 'query_var' = & gt; false, 'rewrite' => true));

Edit: You can also add 'taxonomies' = & gt; Array ('publication') to register_post_type args.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -