本帖最後由 非常小黑 於 2013-10-15 00:05 編輯
w5 y2 D3 t" o. B7 K" w) E7 ? j/ R% E! P7 r# \7 o! {
默認的列表頁,顯示的文章,都是全部文章(或者摘要)! X5 M6 v/ C, z6 L7 H: k7 k) o
怎麼修改才能只顯示post標題列表?
- Y4 q) \3 v" I- k7 N# vcategory.php這個文件代碼如下:- get_header(); ?>
; Y9 R v* T3 r$ E1 f7 k5 N
/ I$ \0 ?( |8 Y9 b- <section id="primary" class="site-content">
+ c1 \: F9 x6 Y - <div id="content" role="main">: [" D/ y7 E) _6 h# C
) E$ f- A$ m. U- <?php if ( have_posts() ) : ?>
8 L4 b+ S) q, B$ I" F3 z4 t! @ - <header class="archive-header">/ ^* i8 v3 N7 x l+ j+ p
- <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>; i$ H* e: H5 X- U0 q
- , N1 @- B; N T
- <?php if ( category_description() ) : // Show an optional category description ?>
* Q! m2 ^( H# ?% r - <div class="archive-meta"><?php echo category_description(); ?></div>
, L7 w+ O9 G& @# k0 E - <?php endif; ?>$ \4 ?3 h( M7 a
- </header><!-- .archive-header -->
0 x8 n' z; ^* G; |+ }, ~
8 }9 t1 v; S6 V, @7 k. }+ ^& H- <?php$ X, D1 N, U+ \' Y
- /* Start the Loop */
' ~1 Z1 J" @; }, g" K+ ]" |! M" P - while ( have_posts() ) : the_post();
$ i: T: [1 s7 D' B, p# i2 I - C6 H- a6 E- h9 ]7 u
- /* Include the post format-specific template for the content. If you want to+ ~: w/ G1 R& R: C6 F
- * this in a child theme then include a file called called content-___.php6 i* f( d. N4 L" G6 O$ u
- * (where ___ is the post format) and that will be used instead." I' H4 v+ O* D" x. @. k
- */2 z9 }" l- v. \* R
- get_template_part( 'content', get_post_format() );7 U+ v6 J2 M; Z/ Z
- 4 Q' _5 |: f5 H# E/ @- M
- , _1 o4 S3 K/ e6 V2 h: q
- endwhile;
# A, r4 W" r( j" T0 ^+ s: N% H! X( A
2 G3 N i8 Q6 g4 c" T0 f2 D7 l- twentytwelve_content_nav( 'nav-below' );
, r* A5 E# W& h( W" L - ?>
% | [) |. S* y! l - 2 f( b2 R3 L& s3 a" K& o$ c
- <?php else : ?>! F( b* A- q! j# }8 v: y% t
- <?php get_template_part( 'content', 'none' ); ?>4 u4 r7 y, `" w
- <?php endif; ?>
5 a4 ?% |0 w2 e. v& p6 A
% x7 k0 Z9 _5 g- </div><!-- #content -->/ ^; r+ w- v# T0 H
- </section><!-- #primary -->5 A6 s9 i. U5 Q
- , X& }# h2 H! A2 q2 L/ _$ t
- <?php get_sidebar(); ?>+ r% V7 J0 H$ v2 p3 j/ s e
- <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )
2 Z( Z; W3 p5 M9 X, g; m- h應該是post的格式吧?% t6 W! T5 l7 ^0 M- I
然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。
7 O: i5 [/ b" c1 S# m那麼我傻了。。。
9 G E: w/ W! q各位神出來幫忙啊。/ \* D9 ~5 }. |$ C( J9 u! {
& o9 i! a4 `8 K: s$ `0 p P4 ]; F7 r! y7 @
|