本帖最後由 非常小黑 於 2013-10-15 00:05 編輯
) a) \ i6 f$ b& h! H, M# f P1 v) ?2 z) M7 u0 X7 P5 i
默認的列表頁,顯示的文章,都是全部文章(或者摘要)
$ s' E: @: ~. W2 z5 w' W y" [' I怎麼修改才能只顯示post標題列表?, z: T1 Y* c- k. P" w
category.php這個文件代碼如下:- get_header(); ?>2 ]- a3 T! {* S( ]+ B1 T/ V8 v# f
6 x. E# g3 h8 t7 F+ O' }- <section id="primary" class="site-content">' M2 _ M% k3 H0 _
- <div id="content" role="main">* ~- e; d/ i# w. a
5 w: U" e' z9 G0 w- <?php if ( have_posts() ) : ?>
I Z+ s8 z1 Z1 `( h - <header class="archive-header">
3 v2 F+ k* c* p8 ~0 R - <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>
4 i0 Z4 l( h' l4 Q) l
# Y+ c; d% P2 p0 w8 J- <?php if ( category_description() ) : // Show an optional category description ?>
& f+ I+ |+ Z9 Y( g9 d" R - <div class="archive-meta"><?php echo category_description(); ?></div>
; b* v- B- a0 F1 O& | - <?php endif; ?>% f7 l9 ]6 i `, K! _- o# ]5 ?
- </header><!-- .archive-header -->
1 X: \4 S8 a5 j7 _0 ^8 v
! y2 z5 E, Z1 V3 }- <?php2 x4 U, N4 v6 C S+ V2 |
- /* Start the Loop */8 C* j+ W( S5 U _" X# G9 C
- while ( have_posts() ) : the_post();
4 _5 c Q1 f6 Z* d* ~8 z6 p - ( F& d& S' [5 M6 v9 B9 Y8 E, y
- /* Include the post format-specific template for the content. If you want to0 w. @5 j& Y' D; a
- * this in a child theme then include a file called called content-___.php
9 K* U- c$ r% f6 w" H - * (where ___ is the post format) and that will be used instead.- v5 [4 l, Z1 } i5 B/ Q
- */
$ P- A: r/ B( W - get_template_part( 'content', get_post_format() );8 p3 W& U% ^9 ? z5 A
-
1 U W) c) O: Q! t* O+ _! f
0 T$ |4 ], C' n- endwhile;$ |( ?6 Q; e, q! g( `
; x; Q7 Z" z$ z, m- u& \( u- twentytwelve_content_nav( 'nav-below' );& m. C |4 W1 k' o. d
- ?>: U" b' [) W: d4 r
- 7 A7 K. r/ ~) H/ D+ f
- <?php else : ?>
# F- P& v, ]- ?' ?: u7 q% j - <?php get_template_part( 'content', 'none' ); ?>
* f7 E0 Q4 F2 L0 _" J0 X. m( B: S0 E - <?php endif; ?>
$ a2 M- K) r7 B7 P
( b+ [% x1 r' ^# a, V# h- </div><!-- #content --> T1 S$ H( k( H; i7 e+ j
- </section><!-- #primary -->
' W3 v* N+ d7 I - * I' `# u; P2 ?0 X" Y1 e+ L; d
- <?php get_sidebar(); ?>
7 X7 j. @& u, ]/ `5 f2 f; K2 f7 g - <?php get_footer(); ?>
複製代碼 get_template_part( 'content', get_post_format() ) i4 `4 W' Y; X( E |$ H' d' z
應該是post的格式吧?# E" N6 C; l; x6 [
然後我在content.php裡面,找啊找,沒找到對應的 if is_category() 這個判斷。( j6 |/ Q& N: |* T# [$ G1 b4 W6 ?% k
那麼我傻了。。。' k" {+ N8 r4 {
各位神出來幫忙啊。5 j# Y. {$ e1 V* T# R' i+ m
/ F- M4 o: X: z/ W$ y3 c
+ `' z3 d9 z. H$ f |