本帖最後由 諾基亞 於 2011-10-3 09:48 編輯
& ]5 ^5 h. k) c9 K; ]- S& T2 x( i0 T; z6 g
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面/ p3 N _, _! N. T2 f+ T5 g
! h @4 d9 r5 c5 k& _* @如果要用,4 J# S# J" U' {0 ?! L6 O7 c
打開index.php
' h+ Z% q' D3 D0 e. ?3 `
- t6 a- x; K8 Z! F) W
9 @' ^' L3 F0 S$ ?; \$ M+ e找到<div class="intro">; j9 F' u, F+ ^4 S9 P$ v! g
<?php if(is_category() || is_archive() || is_home() ) {2 ^5 X, g3 x, F8 ]! y9 V
the_excerpt();/ \% ~( V# }. l
} else {( n) U/ B& f2 |( f' o: ?# L8 L7 P
the_content('Read the rest of this entry »');
$ _6 R( w) B. R; Y R } ( e1 a: t V3 P& l) A/ s7 L2 p
?>
. t8 Y" g! J" s0 g </div>
' K* X. @. ], b: {, J7 z- @& P3 T( s8 B; ], D7 ^5 m
修改成0 {' G! j* s# n
<div class="intro">
* X0 }5 F- \; l) P6 U, \ r5 J <?php the_content(); 4 N! m" t Q( q
?>
: ^! n6 n1 j8 Z2 C4 H- ? </div>; y. w, A1 v% \, u3 _0 E5 h
" P6 q' a6 m0 u" X; w( Y
6 ]( e7 ?* S# A8 ?
4 w# @! K Q9 L5 P3 T! g A& B
打開function.php,找到最後,刪除
D. {! K4 B, K. i9 B0 Q9 e
- h: v; l% X: Xfunction lpa_replace_content($content)
' I$ F6 S$ t5 j6 U6 z{* K& ^8 N2 p; ?& E: R
// Get data from database
& @, S) }& j8 _' i $lpa_post_wordcut = get_option("lpa_post_wordcut");6 n- r/ u! Z& Y, K, |
% V) K) R. g) g8 {4 T* H H
$lpa_post_letters = get_option("lpa_post_letters");- Y" H/ j6 S0 w+ m& V4 {9 a: f9 V
$lpa_post_linktext = get_option("lpa_post_linktext");
; s( T G! B; }: L+ P $lpa_post_ending = get_option("lpa_post_ending");: B% }5 g: }* Q; M; x' [' e
/ M5 _1 @# N2 F6 N6 Q; y
$lpa_post_home = get_option("lpa_post_home");4 m) F; L4 E# y2 [% z, g3 B6 [' c
$lpa_post_category = get_option("lpa_post_category");
- C8 V P- l! t8 x: I $lpa_post_archive = get_option("lpa_post_archive");
j% J# _3 ?1 ~9 {# y' P $lpa_post_search = get_option("lpa_post_search");; d' d' v/ Q5 i/ F6 h. x
$lpa_striptags = get_option("lpa_striptags");" o0 X/ R3 T, Z( x& G) {
`. W6 y* X6 R9 A* ]! l // If post letters are not set, default is set to 300. G4 E( Y& }( {8 [" s; K) G
if ($lpa_post_letters == ""){
: {% k9 q d/ k2 B; w$ j' J& L( _& Q $lpa_post_letters = 300;- [2 T6 @+ s- |8 a/ d
}. `0 G# J% Y* N' j, {; T
if ( is_home() || is_category() || is_archive() || is_search() ) {5 H! k" y1 Z! L. y% T ]0 k* B2 d
4 s/ G3 \% O$ M+ D) R1 K $paragraphcut = explode('</p>', $content);+ }8 f2 |# U1 J& i$ n5 s9 V
global $post;4 [9 M6 E/ b4 j: {# Q' G: F0 I
$ismoretag = explode('<!--',$post->post_content);1 [# Q, _% E( Y& Y
$ismoretag2 = explode('-->', $ismoretag[1]);! i% d. G7 k; Y }
if ($ismoretag2[0] != "more") {
0 R) j: t# t1 v- E6 j# L& @ echo $paragraphcut[0];
2 n! j' q3 \5 L, f# F( b echo $lpa_post_ending;( d. p+ H5 o( g5 {3 W% g
if ($lpa_post_linktext != ""){/ v: H& J6 P7 S) K
//mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";& i( T' q4 X t8 e7 `
echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";
$ I" M7 h" _+ |( B! C+ O& A1 S) I/ f }
! T' k" D' T; [9 t/ y$ F echo "</p>";
" L7 \1 G9 z% ~# o" o }
9 G( h. U% g- @0 I else {
5 u& m6 a: A3 k6 m return $content;
9 t3 y1 v) ~* R- n4 j }. Y% h" i s+ Q( L; V5 r6 a
}6 u. p9 [0 B5 {! l2 p. ~ h+ h
else {
* U# w" c3 M. J; A9 H return $content;9 d6 l% n: X$ s( J" S% L$ Q% B
}
6 H, R6 z7 N5 X
! o/ a/ G1 m6 @% D( v& m}
1 Z9 q* G% y, g' H" oadd_filter('the_content','lpa_replace_content'); |