本帖最後由 非常小黑 於 2013-10-15 00:05 編輯
" n# N @7 u8 t0 ]' t* u" P
1 S3 I- {# }& u& s* K% r默認的列表頁,顯示的文章,都是全部文章(或者摘要)
$ t* I- ^) W/ z( i2 g" F& \4 z怎麼修改才能只顯示post標題列表?2 F8 ^& V0 @5 K! y. Z# D8 w
category.php這個文件代碼如下:- get_header(); ?>
9 n5 q* d. Q+ r: f/ E! f7 l - ; d* e6 o( q m7 H; F# R) s
- <section id="primary" class="site-content">4 S6 N! l6 a# K+ B d9 e* J
- <div id="content" role="main">
+ x k) h0 x1 p* j4 B - 5 w/ _- \7 }/ Z! i& y
- <?php if ( have_posts() ) : ?>4 K, n( ]9 q" k3 S# J7 u4 o
- <header class="archive-header">
7 l# D# b6 u# M2 `7 v - <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>
/ h; U4 W, P& \2 l& ^+ ]. Z; ^5 |% d - 9 ?$ d2 M9 `' |7 w
- <?php if ( category_description() ) : // Show an optional category description ?>
1 O+ H& w8 V: V9 e - <div class="archive-meta"><?php echo category_description(); ?></div>
0 P% C3 H! C" P% V/ x8 l% U - <?php endif; ?>
u% N+ X. } C( ~$ q: q1 X7 c/ B- j - </header><!-- .archive-header -->
6 ]' t* s* V) n- M2 h - . j x1 l) d5 N! r0 s% D& s6 {% d
- <?php q- J3 |* W: i6 p z: d7 S% T: M
- /* Start the Loop */
- r' K* J6 l8 s- l" S% R ` - while ( have_posts() ) : the_post();0 U* m* l% O- D- u) l2 X$ ?
& \ }9 l4 L; A) B) f' c- /* Include the post format-specific template for the content. If you want to6 A" V2 S& Z- D) P) C& |% t
- * this in a child theme then include a file called called content-___.php& u8 }9 {/ l0 a/ L" n- C
- * (where ___ is the post format) and that will be used instead./ p2 k1 i5 m9 g) M4 e
- */
, H" d d8 t5 e; U) p5 P- q - get_template_part( 'content', get_post_format() );
. D' @% X0 {: J* y' d: Q7 Q -
8 q0 T) t/ e! b+ s - , M+ U- Y* y0 c- Q
- endwhile;
, u* Y+ K1 P/ w
6 f8 {- P$ }- T+ v! K& Y' L% v6 f; H: X- twentytwelve_content_nav( 'nav-below' );
: E3 B9 Q* D! f# B# T$ n) X - ?>
! V" p1 n' n8 k. ]$ q, I - * y; F( B( D- N1 N
- <?php else : ?>7 G- H, e+ y1 Q! ~% p
- <?php get_template_part( 'content', 'none' ); ?>
# b8 E1 t1 @9 M% g3 m - <?php endif; ?>" f$ ~; g3 D1 A! T! X1 w2 B$ p
- , U$ l' O7 m2 E3 N+ n% z
- </div><!-- #content -->
5 @1 G6 }/ _3 m3 T0 V: C - </section><!-- #primary -->4 L: m# N! w/ H% V
- + C, F3 o+ X" B4 a3 T+ _2 G' }( f
- <?php get_sidebar(); ?>: T+ i d7 K* \+ C
- <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() )& ]9 L8 x' T( s) t5 ?9 W
應該是post的格式吧?
/ C. O7 i5 ~* a- M" i& A. b0 `然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。; \ Z6 l, B4 B
那麼我傻了。。。3 q9 `" F7 z _. H. l+ a* M* C
各位神出來幫忙啊。$ W/ O5 n* P# L9 K3 ]/ g, S
! p) [& H; ^9 E6 s( P1 X. H6 I; d* D
|