假設,我想把category這個頁面,變成和page頁面一樣,可以加上詳細內容。應該怎麼修改' V. H) S- u9 y0 J% K" L
baidu了好幾個小時沒答案,google了好幾個小時,找到一個答案,但是沒看明白怎麼操作。- function filter_category_descriptions_in_admin( $terms ) {0 p1 j) N; H, }! Y( Q
- global $current_screen;6 A/ @# y) R0 H0 L
- 5 D& |( @& E2 B- D
- if ( empty( $current_screen ) || 'edit-category' != $current_screen->id )
; P. V# R( O2 F- l - return $terms;: ~5 R0 `- v6 N
- ( e7 T: e) X2 N9 X8 a
- foreach ( $terms as $key => $term )3 \% D* A4 i I. U' e7 S/ A
- $terms[ $key ]->description = apply_filters( 'category_description', $term->description, $term ); L& G9 ~7 Q5 o! M) T- t
' O0 K; o* ` I! o8 u: J- return $terms;& Q0 O- Y$ ~1 E& V# {) |
- }
* b/ A' Y! @% R% u4 b9 X, ?0 d% l - add_filter( 'get_terms' , 'filter_category_descriptions_in_admin' );
複製代碼 有沒有高手解答一下?
- O8 t; ~2 a! x; I, c3 u" I: }; O* H( k7 k
|