本帖最後由 諾基亞 於 2011-10-3 09:48 編輯 ! V0 @' F( m, M7 w8 w" v5 \) h7 w$ A
8 g+ n B# y& r( `% M9 U/ g8 E$ I8 B
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面
! q$ M7 ]$ X \" a3 D# S
$ d, J" Q* B, i/ Q6 W i如果要用,+ R2 d; O) T( W6 `' [) g7 ]
打開index.php
" u5 U4 D6 M" h( P$ ?" F v, q2 L5 c" C. D) R8 r5 f
r' F ~) w0 J找到<div class="intro">
; o' r2 I1 l" E% Z. Q7 D' V. ?! H <?php if(is_category() || is_archive() || is_home() ) {( N+ k; Q# g, V- [; S3 y! T5 H
the_excerpt();
" {8 [6 J8 A Y7 Z } else {. v" M2 Q3 W. H" v% x
the_content('Read the rest of this entry »');
8 T$ s& y$ y& B+ W* c$ J8 G% d } 3 n" O! M) Z, c; R1 b% M+ h
?>
3 P, H! y/ R% _: s </div>+ c- J# y+ M, I# w# J8 Z" z/ Y
5 p: W% D3 d& T修改成2 h9 m3 \$ `4 d+ d+ x W
<div class="intro">+ J- r) i- Y* [/ F, ?5 g
<?php the_content(); Q) Z- K# L, B7 [8 ?4 v
?>
/ g% x% c! u( k+ U </div>: ^ p- X) F4 M( o$ w/ g+ I
: x- j& R! F9 a) h1 Y, p0 B( {4 k1 O! u; P" U2 f) ~+ y& M
/ q* c# T- k8 L. W+ E! C2 \打開function.php,找到最後,刪除
# j- _4 u+ Y! L6 |9 S( H) g0 B7 G, b3 T, z7 J1 d# ?2 V) v; ?
function lpa_replace_content($content)
4 u- I- w( @; d{
7 d$ z% {; E" T* h% r; k" E% `0 }( s // Get data from database
. p# t9 k9 J, l. q6 g9 [* y $lpa_post_wordcut = get_option("lpa_post_wordcut");
' H$ V! _4 p7 O) ?9 N 6 U: W0 C1 }1 x. C4 ^- T+ Y
$lpa_post_letters = get_option("lpa_post_letters");
3 j; I2 I0 Z, g7 n1 a $lpa_post_linktext = get_option("lpa_post_linktext");; z2 O8 W( G/ r$ Q& D( p" o' M7 j
$lpa_post_ending = get_option("lpa_post_ending");
# H+ a- s% Q& } 1 `. E9 u, b1 q( p
$lpa_post_home = get_option("lpa_post_home");" @$ K! B/ M9 a S+ J1 Z( p
$lpa_post_category = get_option("lpa_post_category");6 B1 P B5 L( H0 [) q% J4 W# I4 q: K
$lpa_post_archive = get_option("lpa_post_archive");8 O$ b" w* z; V2 u$ Q5 P
$lpa_post_search = get_option("lpa_post_search");4 n" w1 Q' _/ z U
$lpa_striptags = get_option("lpa_striptags");
. u8 T9 t$ C6 d" ?# m, ?; Z4 T8 M* x$ p. s. q. `3 e3 d
// If post letters are not set, default is set to 300
) z, E, f: M/ I* D+ X( i! z5 R if ($lpa_post_letters == ""){5 W' a2 X f; q' M
$lpa_post_letters = 300;* i! H K2 ~- o* M2 r
}
* y9 Z; R5 e$ w- ~ if ( is_home() || is_category() || is_archive() || is_search() ) {6 y, k8 y" a0 Q9 f2 K: r) f/ t
; r2 T$ S9 ]$ \) J) `9 t5 l $paragraphcut = explode('</p>', $content);# D+ C$ D1 Q3 o2 j
global $post;
, H0 Z* V1 m% H4 i* r $ismoretag = explode('<!--',$post->post_content);! I8 {3 C4 y8 H+ I4 }' D( d e
$ismoretag2 = explode('-->', $ismoretag[1]);
; y$ y, \9 H2 g* ]5 C if ($ismoretag2[0] != "more") {* h9 U) e+ l$ N6 U \9 H0 I
echo $paragraphcut[0];. `6 p- [. e. K/ [! Z, o
echo $lpa_post_ending;
% g* N3 ^4 l0 }: Q if ($lpa_post_linktext != ""){
/ M- _ G4 a, a5 j% p# m' A0 g' D //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";3 M7 F' G" X7 x+ x" ^, D
echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";" [9 _5 h4 M6 M3 l( _/ ]
}
. e) k$ ^% w8 {3 y/ Z- P5 v echo "</p>";5 u* e# M. k6 G2 m6 f. S: Q8 Y& U! C
}# T4 [# C3 o9 o& `% ^1 k5 Z
else {
) m8 l/ `7 T9 r$ `+ A) V return $content;& i. b+ }+ P. t- n" Z6 \ N4 Q
}- h U1 j2 G% q+ q
}4 v7 H( N# K6 _3 D q
else {
7 B7 k/ _7 U! ?3 S return $content;
# X ~$ L. V5 g1 Q V& v }
4 y2 W) g/ N U
, Q1 i V/ t6 |& m. D, S" i/ \}
% j7 J! X1 t) e5 iadd_filter('the_content','lpa_replace_content'); |