本帖最後由 諾基亞 於 2011-10-3 09:48 編輯 4 {$ c J i! D; f8 X6 J! s1 `8 `
3 J2 v! z8 M/ d7 _5 I l
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面
' }: X9 M8 K9 _2 V, N$ B# {/ Z$ e- J6 Q5 r+ ~" `* }7 z
如果要用,
3 E# W/ f. T9 P0 c! g4 E9 ~$ H+ v* ^打開index.php
+ H' H, M& a# y0 u7 Z# W6 _
. ^2 m4 t5 q: B- G7 @0 M9 H' J; n) t5 S7 D. l2 w
找到<div class="intro">
; C, o. `/ w9 J0 X' K7 m" d <?php if(is_category() || is_archive() || is_home() ) {
7 u( `* d& {5 g; h& D* G the_excerpt();
( W; U% U: L' I$ [5 v3 i6 e } else {
( k' X5 w, v, Z- u' t \! _4 d the_content('Read the rest of this entry »');
% i9 B/ ? q6 {3 d }
) o8 L2 z* R8 Y# q2 [; C ?>
/ c/ ?- P/ z8 b w6 l4 `! m% x </div>2 a5 m5 a* I! }. W! P
( L; O8 w8 _( n6 r4 t$ Z) `修改成
- i2 u! j# w& N7 @1 \" A<div class="intro">0 m- o4 }6 O1 U" N
<?php the_content(); 8 j) Y2 m: Q s" C9 [# F
?>
$ ?1 s' n- R- v% M& e </div>3 u/ W E, B2 W
" g# G' l) G* k7 y2 P; T' ~6 q. B9 F* U7 p; S" s
3 @4 P6 ~) k4 Q8 A! |
打開function.php,找到最後,刪除& t4 h( R/ W. I* c7 v3 Q0 }
! n: Y: ~0 g4 Cfunction lpa_replace_content($content)
8 m( z8 Q6 n, i" T' t{
* v1 y5 Y8 b8 s7 s0 h( l // Get data from database
& P: P' K/ q* Z0 r5 i $lpa_post_wordcut = get_option("lpa_post_wordcut");/ _. N3 w# Y9 p4 Z
. j- R+ ~& o. y- } $lpa_post_letters = get_option("lpa_post_letters");
; h# v: Q' ?9 s; T. m ` $lpa_post_linktext = get_option("lpa_post_linktext");
$ E2 v3 k+ n! L $lpa_post_ending = get_option("lpa_post_ending");5 I3 r0 ]7 i- H6 Z- j8 W
$ ?$ k& u! D# ^) D $lpa_post_home = get_option("lpa_post_home");
9 \0 K+ j+ L( k1 h! b $lpa_post_category = get_option("lpa_post_category");$ o6 p8 R9 ? D- F" I( T+ S, x# c
$lpa_post_archive = get_option("lpa_post_archive");( i; T" w6 L- u: G4 U! D" s9 |+ n
$lpa_post_search = get_option("lpa_post_search");- N$ [3 e' Y8 l& z. |- ?
$lpa_striptags = get_option("lpa_striptags");$ |% e9 O8 H7 G7 V* ]
X7 c s8 ?! \! y& z) n
// If post letters are not set, default is set to 300
3 j2 y( y9 s5 z0 Q3 _+ H1 J# d if ($lpa_post_letters == ""){& C9 D6 V# m" b9 Y/ v' U
$lpa_post_letters = 300;
6 P9 k" \( R3 d3 t' c7 {' | }
4 [% m; a1 W$ u5 y; ` if ( is_home() || is_category() || is_archive() || is_search() ) {# i. |+ v* e5 Y. Q% R
2 U/ T* h6 J+ h" S' @4 [ n6 u8 t( i
$paragraphcut = explode('</p>', $content);
0 C* M9 ?( |0 f global $post;6 o/ C; ]5 e8 T: V- S/ k
$ismoretag = explode('<!--',$post->post_content);
; t* p% t- G3 V1 v* D X ~( i& u A $ismoretag2 = explode('-->', $ismoretag[1]);- _; t: ]" D4 ^& d0 m1 O
if ($ismoretag2[0] != "more") {$ [8 R2 v) F; V" r# r$ u
echo $paragraphcut[0];* U0 j* C+ O! D$ X, G! [( `
echo $lpa_post_ending;
6 ]/ u/ M, k; B6 ]4 ` if ($lpa_post_linktext != ""){
7 P9 |% L2 ]' J K, [+ w: m //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";& r; A0 g8 M& N$ e0 E
echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";( c+ f+ T( D4 \) b% e: W
}8 V" U- }! @$ a
echo "</p>";* O2 _) ?0 z0 p' ]' i
}8 m5 C3 T3 p& N3 ~0 F5 D+ Z5 L
else {1 H4 S$ k% z* c# I d0 z6 Y9 L
return $content;- i+ Z J, z# j$ X, P7 {* S
}% }- Z3 X: R( }
}. n' S3 {5 U+ Y% J X
else {5 M8 e! F6 p8 y5 v6 i* k, m( K, ?- A
return $content;% [, s0 R" c- i9 n
}; G. Y" S7 R7 `1 D
! Q; p/ [0 U& m}
8 \# j6 s, a) [* }: G, Z: eadd_filter('the_content','lpa_replace_content'); |