本帖最後由 非常小黑 於 2013-10-15 00:05 編輯 5 e6 x% }/ |' i/ c
C% h1 b5 X9 G2 H2 ?5 k默認的列表頁,顯示的文章,都是全部文章(或者摘要)
6 p" N9 B% L- U' M5 q" J* W3 ~. V怎麼修改才能只顯示post標題列表?
) z; m7 N3 i% J. ?7 acategory.php這個文件代碼如下:- get_header(); ?>
! D6 h6 H7 b4 \3 c2 t# `8 F& u - 7 ~; `5 e- ? r |
- <section id="primary" class="site-content">
3 G- F$ v# `) B. w1 b2 _ - <div id="content" role="main">
% q( r9 v1 G5 y- L, X, F) B: K8 u9 s
4 y; Y8 E) e @+ o! m- <?php if ( have_posts() ) : ?>2 D. X. ~6 x5 k: z0 t0 }2 S
- <header class="archive-header">
: H4 Q4 I2 g3 v) A - <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>% c8 U# x2 v7 r& ` U& r$ S
- % R4 b" o Q A! a1 e# v" ~) [' P
- <?php if ( category_description() ) : // Show an optional category description ?>7 B- d& E9 {# G2 F
- <div class="archive-meta"><?php echo category_description(); ?></div>
( o/ t/ s2 L, D - <?php endif; ?>
" y! \/ N9 L1 C - </header><!-- .archive-header -->
4 L0 D( H* `; L' c$ C6 Q
) a; x* B' u# r) \- <?php; h9 i) |9 ]7 e2 O+ @+ K" H
- /* Start the Loop */' {$ M' P4 o) ?) _# F; c! q7 d; n
- while ( have_posts() ) : the_post();7 x3 k$ E7 u& \: a$ _
- ; g T: V$ A) ~' `& ?2 N8 K
- /* Include the post format-specific template for the content. If you want to) G7 D- }: D, |) O2 r
- * this in a child theme then include a file called called content-___.php9 D1 W$ S+ h; F, g1 q
- * (where ___ is the post format) and that will be used instead.
1 B) ^+ g4 X5 u* C7 @& S* v1 o& f - */, x( @9 Q; [8 [
- get_template_part( 'content', get_post_format() );- c7 w6 A- N% q. }5 j( Y
- ; L" w7 ^' I* F1 O1 B
$ }! Y0 m! V8 M, T- endwhile;
, }' h5 k# X7 e" Y: I - " p) X" H6 _1 @2 b
- twentytwelve_content_nav( 'nav-below' );
. _* @4 P0 W; N8 k - ?>
5 h' Y# V7 |" B9 e @5 ?
+ e" ?* I) r% V D5 [- G- <?php else : ?>
! \/ D& a; }0 l2 q, U; ^/ `, `" H( u - <?php get_template_part( 'content', 'none' ); ?>9 W5 s$ ^7 q4 {& D5 L/ @1 R
- <?php endif; ?>* v2 C) Y" H5 ~5 f" T8 y2 v
- 4 W0 u) _$ {8 j( N* O9 O
- </div><!-- #content -->
" Z9 j- j! L! h2 L: h - </section><!-- #primary -->
+ e9 u" }& y; I' r$ X
( g: ~) p: k. ` j1 o5 i- X- <?php get_sidebar(); ?>9 o, @7 f/ @' N$ S
- <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )
/ S9 T% p0 H* P應該是post的格式吧?( x4 Y) |9 Y" }6 i/ z
然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。5 {( v4 t2 ~& B
那麼我傻了。。。& r, x# W6 N# E7 }8 [
各位神出來幫忙啊。4 Y9 q) S( `/ P% U' c8 e) v: l
1 @, G: H+ U# S) w: V( B
! G S/ [! r; Q) q, n- ]
|