本帖最後由 非常小黑 於 2013-10-15 00:05 編輯
+ P- Z4 A! C- g( Q+ u& Z' Y+ H+ c; b! l' E- r& [+ c
默認的列表頁,顯示的文章,都是全部文章(或者摘要)+ @. f5 b% k' w; U) \
怎麼修改才能只顯示post標題列表?
; h+ R' x: b# ^+ V5 ?/ p( Q0 s2 \category.php這個文件代碼如下:- get_header(); ?>& W$ l% O$ y% g8 z$ [6 I1 m
8 @ v. u7 T1 f5 K1 o! [- <section id="primary" class="site-content">
2 r! C$ q) Q3 s' _. K - <div id="content" role="main">1 r' z {4 w, c8 b& c/ a7 i/ ~
# z- T+ i6 i/ }% h3 w1 G9 c: [- <?php if ( have_posts() ) : ?>& Z0 P5 \0 f7 ]* z& R$ Q5 {
- <header class="archive-header">
* N% f' b" J( k9 E - <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>7 y& j O Y- z$ g- j8 v8 f
* ^3 V( M4 w7 v1 k- n: l, K4 U7 ?- <?php if ( category_description() ) : // Show an optional category description ?>" H8 B: x, v7 S* B5 W3 X
- <div class="archive-meta"><?php echo category_description(); ?></div>
. _+ f; F4 N9 q- e - <?php endif; ?>$ s( Y2 h% b H4 U! s
- </header><!-- .archive-header -->
" E% ]. m! e: ^' O+ ?
5 Y. i% P! Q( j1 ]- <?php4 ^2 h) R t6 f' B! m3 D T1 I
- /* Start the Loop */
3 m% t+ A8 T3 x, ~# g* R - while ( have_posts() ) : the_post();
! P+ M8 q# k/ Y' V- O+ A$ M" X
1 p; p& B6 x5 E4 r8 u- /* Include the post format-specific template for the content. If you want to
1 t0 i! Z* o; L& [' c3 D - * this in a child theme then include a file called called content-___.php
, k) J ?6 b% q$ A3 T' U0 T# A4 { - * (where ___ is the post format) and that will be used instead.2 B2 A. V+ F5 I
- */
7 d& E3 N" M- w' n8 f Q' M8 g" J, g - get_template_part( 'content', get_post_format() );' y3 P2 S" c8 q9 v$ g) B8 D8 d- h+ y
- * }+ o* d& M7 `$ s2 ^
6 f* O/ K6 Y; [1 {- endwhile;
: f1 ^9 g% s! E, J - 2 P9 S+ q ]) k- m6 w I( P
- twentytwelve_content_nav( 'nav-below' );' N" c- Q P3 g @
- ?>
, I- R5 Y) Q* M! Y
, N6 ~4 f$ q6 P7 b9 w- <?php else : ?>& x4 e# u0 H e& n
- <?php get_template_part( 'content', 'none' ); ?>
, Y! F; d/ V; y4 C w2 |# s - <?php endif; ?>
) g& v- I7 Y( y% o j
+ Y) R. R C5 K. y" T- </div><!-- #content -->/ d: ]. Q% [* e+ `( Q+ s% y! e
- </section><!-- #primary -->
+ L% z- w. w9 \ - 1 E n* F, d0 H \' ]
- <?php get_sidebar(); ?>" P7 c" Y! X" R5 J0 c; r7 E
- <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )
2 g5 O0 t1 V6 C/ h+ t應該是post的格式吧?
2 B! T' ?7 n, b* L) q然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。
1 b: V' K- B, E9 ^$ H( f6 [那麼我傻了。。。- v/ o# q* A% i4 s1 s, w
各位神出來幫忙啊。6 V/ T9 G. I( M; L3 Q
' e7 D3 L: g% w# F$ Q2 K( E5 R4 _! f. S
|