本帖最後由 非常小黑 於 2013-10-15 00:05 編輯 5 Y+ B( \: d' I" L* |8 d3 q: x
% ^1 x* t6 |3 ]8 R3 K y
默認的列表頁,顯示的文章,都是全部文章(或者摘要)
) ? n% D& b- p/ C怎麼修改才能只顯示post標題列表?
3 U# n% f4 c0 v5 H# s( L1 Kcategory.php這個文件代碼如下:- get_header(); ?>
3 q. l0 c5 F% B; i; F& B# B. {! W
! s" z: y9 n9 _- c1 E; c! s- <section id="primary" class="site-content">3 m1 X) l& I6 w/ W
- <div id="content" role="main">: U' r# |6 N) a- {4 P2 o2 z6 ~9 J5 k3 j
- 8 u0 T6 I: n- H D8 r
- <?php if ( have_posts() ) : ?>
5 V% Q6 Z! x# M/ \4 a - <header class="archive-header">
! Q! B! q3 R0 S* s- u - <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>8 n2 B# o5 B' Z; ]( o
s! r s: [: {/ G* E- <?php if ( category_description() ) : // Show an optional category description ?>$ L+ v1 p: b) n9 `7 }. j
- <div class="archive-meta"><?php echo category_description(); ?></div>/ ~4 W5 S# V9 x/ Z4 y
- <?php endif; ?>
4 o$ `" s2 T0 D9 o1 ]5 H" u+ } - </header><!-- .archive-header -->4 S. l T$ C' _- C9 h& n6 n
! u# q6 U J `2 s j" q- <?php
7 R/ K/ v1 H, I6 O* ?) d* G - /* Start the Loop */ S9 [9 b# x+ a# M9 a4 W1 B
- while ( have_posts() ) : the_post(); K2 C$ ?) o* Y+ D* L
- 5 S7 o0 h( t2 u: t. A$ K
- /* Include the post format-specific template for the content. If you want to8 `7 U. [8 a" f( u" h9 S
- * this in a child theme then include a file called called content-___.php
: z- j$ Z5 ]% G l3 f* a - * (where ___ is the post format) and that will be used instead.) l0 g- N( k! f: }, j
- */0 [/ m' |5 Q. ]1 H0 A, ~' K2 v3 z
- get_template_part( 'content', get_post_format() );. s. w) R, k7 ~4 h- w( L2 ?/ R, _: S
-
/ ~0 x& ^( L" C* B0 Y- m* Y- ? - ) `% ~* |1 g5 g. c+ C' r( b4 O
- endwhile;* i. T0 h9 `( f& y) I0 L+ |, V- E
( R/ ~6 K3 Y! e9 A4 y- twentytwelve_content_nav( 'nav-below' );! o3 T- T; W: ]% Y: n! E
- ?>
/ b$ p0 B1 L3 s' j( c4 c; R! b
j9 e/ W/ S0 S" a5 U- <?php else : ?>
8 o' i% H" l0 P - <?php get_template_part( 'content', 'none' ); ?>
3 z1 C# p3 f7 u; K; @7 t - <?php endif; ?>
8 L# i/ A: l# _9 a - ' K3 ]( N( K# e i2 t% ~9 H7 T
- </div><!-- #content -->( A+ Y P9 q( j2 \
- </section><!-- #primary -->2 m/ r) A3 ?7 A# g9 d7 L
- X/ T! Z5 K0 i7 A( `
- <?php get_sidebar(); ?>
# c( o0 B/ h& b/ g2 c' Q! o - <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )' o, N9 l4 K4 \
應該是post的格式吧?9 K% H$ N6 S! ]- t
然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。
0 I% X% b$ P3 T- {4 ~5 Q! r- B/ U那麼我傻了。。。
4 ?4 U" E/ S3 |各位神出來幫忙啊。
6 h/ \1 r% T5 y7 {+ Q7 J' Y
, {0 w: r) x6 _, ^8 J; [* ^# U; O- _. m' |& y: W# X8 G7 G% F
|