假設,我想把category這個頁面,變成和page頁面一樣,可以加上詳細內容。應該怎麼修改
3 t9 ?6 X; e1 J d+ E0 {8 `( M" }, Ybaidu了好幾個小時沒答案,google了好幾個小時,找到一個答案,但是沒看明白怎麼操作。- function filter_category_descriptions_in_admin( $terms ) {
$ ` g/ k% s* R - global $current_screen;7 v: c% ^) @( L- c/ |# d
- 6 }+ G6 B; O& v1 H( l
- if ( empty( $current_screen ) || 'edit-category' != $current_screen->id ); u! Q: G+ A( j6 ?$ T
- return $terms;" {4 s# a4 K4 d Z& g
! R( T! M1 B+ @6 I! Y, }) I# c- foreach ( $terms as $key => $term )
/ R5 c6 M4 C) y4 A8 r3 l - $terms[ $key ]->description = apply_filters( 'category_description', $term->description, $term );
. Z* W" t6 k/ ]( Q5 W - 8 @% H* ]+ U5 F1 D
- return $terms;' F% m, b2 k# Y# y7 E
- }
6 K- T- O' w ~( h% o s - add_filter( 'get_terms' , 'filter_category_descriptions_in_admin' );
複製代碼 有沒有高手解答一下?
/ v8 P! @. e) [1 A4 x1 [- G
# P" V9 a* `) Y- I |