假設,我想把category這個頁面,變成和page頁面一樣,可以加上詳細內容。應該怎麼修改
8 Z( ~/ a! ~7 _) G. `- Cbaidu了好幾個小時沒答案,google了好幾個小時,找到一個答案,但是沒看明白怎麼操作。- function filter_category_descriptions_in_admin( $terms ) {
6 y- @) o0 P# t - global $current_screen;$ x" _/ r1 i2 o' a
% }' g u. q+ M Y i7 N6 L! |$ e- if ( empty( $current_screen ) || 'edit-category' != $current_screen->id )
8 L; T) l; N; u$ C5 c& k - return $terms;5 L5 e6 w# w- D2 S
% c( Y2 b O* A/ F1 B; X' a- foreach ( $terms as $key => $term )+ z7 G1 { C7 D- u0 e- O
- $terms[ $key ]->description = apply_filters( 'category_description', $term->description, $term );, t, R4 D% `" L h5 |; R
- % s( ~% U. f% H6 J$ E$ i7 x1 f+ e" e4 T1 K
- return $terms;
. `. s9 N9 m1 h# y9 G/ i& i - }
6 r- E5 K) ^' G - add_filter( 'get_terms' , 'filter_category_descriptions_in_admin' );
複製代碼 有沒有高手解答一下?
3 D( E, D* u( `1 _ w4 g$ j5 }- ~" P# g3 l: U
|