本帖最後由 非常小黑 於 2013-10-15 00:05 編輯 9 W7 Q/ y0 A& {6 _ M
- ?2 {3 p, \* s6 a默認的列表頁,顯示的文章,都是全部文章(或者摘要)
( K8 D% a8 `3 O# y7 m怎麼修改才能只顯示post標題列表?1 K" k' U" t. w/ V
category.php這個文件代碼如下:- get_header(); ?>
D$ z# l) x# X8 |5 Q - 8 u( }$ F1 a& K1 u3 [
- <section id="primary" class="site-content">
% ?! V& y5 C, o - <div id="content" role="main">
( |' d$ d( o9 j. S- P
/ j" m7 f- Z! B& y+ r" S/ i% X. P+ @- <?php if ( have_posts() ) : ?>
8 k6 e. M$ v- B& T" ^$ G6 M6 Z5 | - <header class="archive-header">9 Y1 ]/ {1 X) T' n
- <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>( W% m7 U/ m* B- [' c
- 0 z" q/ c3 t4 {6 B% J4 | I0 x
- <?php if ( category_description() ) : // Show an optional category description ?>
: R! J' J5 u8 l2 ]; c - <div class="archive-meta"><?php echo category_description(); ?></div>
1 P6 h/ J) m& w; L( L - <?php endif; ?>4 W; A% }5 R$ Z0 |7 v5 y) I( d
- </header><!-- .archive-header -->" ]) j1 N* t3 a5 D7 z
- ! k6 H8 U+ V+ _8 k$ G0 J
- <?php# Q( Z" W; q6 q
- /* Start the Loop */
4 n/ r: D) l/ e2 G5 U' _ - while ( have_posts() ) : the_post();
; o: h; b& Z0 Z. o) h
& H( [" ~% z {/ @- q' R! P1 C- /* Include the post format-specific template for the content. If you want to
5 z* R1 }; j% I9 y - * this in a child theme then include a file called called content-___.php
& G: i& I3 f& a) Y" ` - * (where ___ is the post format) and that will be used instead.; s. r+ D& z; a5 D u9 M2 u
- */% N$ P' Z/ s+ K8 V, ^
- get_template_part( 'content', get_post_format() );' O& D; N6 l; @8 N: u) D! U2 i1 n
- " R ^7 O1 n& m6 o7 ? k
' E: }* \/ X9 ~" t1 L- endwhile;
7 F. t- Y3 ]# \ - - q0 ]! Z8 c7 K3 g, U# k5 V% O
- twentytwelve_content_nav( 'nav-below' );
8 u( X6 ~3 e! x7 M - ?>1 o3 t" Y. y7 H+ O) `# V2 p2 y% C
- / |0 N! O6 d% E, z V7 q: k) d
- <?php else : ?>( p+ ?( G0 ?4 q! T" t
- <?php get_template_part( 'content', 'none' ); ?>
# K/ }3 U& q) x# y4 A: g - <?php endif; ?>
. F. d1 |9 w) t1 b
6 F/ r: n: C. Q, `0 b% J% F- </div><!-- #content -->
( o0 l8 j% \3 @# Q: N) @$ e - </section><!-- #primary -->: F# N1 L) y# U: X: S! c+ a. ]: q
1 w0 `$ N+ U, V, {4 t& y3 ^, O- <?php get_sidebar(); ?>
/ ~# I$ e4 L) T - <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )( v. Z4 i# I/ ^) U
應該是post的格式吧?" B, C& v/ B5 r, U
然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。
5 |0 E5 Y! N* F u) b. {/ `& l* j; l0 w那麼我傻了。。。* i% X* X9 g3 Y' s, J1 l/ w9 r
各位神出來幫忙啊。8 S5 N6 w. L5 m, ]4 a
! c [1 C# C0 H: V! q, C3 F* Y
1 |9 `3 {# y. E1 [! G* d
|