本帖最後由 諾基亞 於 2011-10-3 09:48 編輯
: A. d1 R W" |" D6 @! [% w0 B2 A4 l3 ?& A8 Y3 ^0 I
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面
6 q& M- {. k) q; H9 i x& S [$ u+ ]6 N2 F
如果要用,
* _0 q/ R# n* t) Z1 f6 v$ s打開index.php) `( @/ K, k2 b, O% E* x
% d, ~: n: I- Z; v( o5 O! G: w, N- l* Q. y
找到<div class="intro">+ }9 J2 T( l5 t1 L) E* v4 u. B
<?php if(is_category() || is_archive() || is_home() ) {/ Y" S1 E, E) X& l* \
the_excerpt();
: D. d/ ?" ~8 p" H" u } else {# j) O- H- H1 d
the_content('Read the rest of this entry »');
# T# y5 f. g( Q2 n4 x }
1 k# T2 l: B; Q. |" ? ?>( t3 {$ c: @+ I+ X7 a0 L6 ?
</div>' @# z& J, ` ]! ^( j
4 g2 y' }, P& _: ~0 B/ x修改成* c# X. B4 f8 {* N# T% Y0 b- o
<div class="intro">
) x0 Y+ `( u X+ J. ~' S1 }2 l9 B <?php the_content(); 9 N) J/ l3 y+ ]* z6 F5 N
?>8 `- x. h3 N: t) Y
</div>
3 g4 q) d7 n" _& H# T7 s" ~* k! Y# O) \0 O1 ~
3 L& d2 w0 b# O$ C9 L2 R
, L" K* r: X) b7 }2 Z+ E W打開function.php,找到最後,刪除
, m& v8 D/ ^/ e1 ~! s4 M5 c; H2 V1 e/ X/ z2 ^; S
function lpa_replace_content($content)% Y, A/ x, w: s# W& @
{' T7 y: ?8 W% G7 p8 ^
// Get data from database
. _/ s& q* e' _- g$ p- h: b! _ $lpa_post_wordcut = get_option("lpa_post_wordcut");
5 ^8 ~' f! g* b4 E$ S! S
4 G6 B w" h+ Y4 I( d' O- @! ]. ] $lpa_post_letters = get_option("lpa_post_letters");0 |8 c- |+ h* D2 W) U, K) }' X
$lpa_post_linktext = get_option("lpa_post_linktext"); R" P6 o, N6 G) H+ |' Q6 x
$lpa_post_ending = get_option("lpa_post_ending");
( N( a% M/ m: f6 Z! X & x8 F6 n9 y# ~+ e, l) E6 B
$lpa_post_home = get_option("lpa_post_home");0 \/ p! G: |9 p
$lpa_post_category = get_option("lpa_post_category");
, V' j; ~/ I7 c3 l $lpa_post_archive = get_option("lpa_post_archive");( D, e6 w9 Q: k
$lpa_post_search = get_option("lpa_post_search");' h" L3 q3 B, l3 K# p
$lpa_striptags = get_option("lpa_striptags");$ I$ P7 Q( U/ y
$ l) q% Z! R5 \' u% m* V // If post letters are not set, default is set to 300
# k$ I* h# u, c* } if ($lpa_post_letters == ""){
# A! l9 a" V; u $lpa_post_letters = 300;# F7 O2 D& b% h7 v
}9 M3 ]' d) A' @3 y( ]: c
if ( is_home() || is_category() || is_archive() || is_search() ) {4 I6 y$ w: U0 ^" x! {6 s8 [
# r" A3 @! }. y. [1 f4 v
$paragraphcut = explode('</p>', $content);4 q3 W4 ^6 ?% O R
global $post;2 I! e$ L3 z7 X6 p: v
$ismoretag = explode('<!--',$post->post_content);. Y& G8 O! k/ R( l0 ^
$ismoretag2 = explode('-->', $ismoretag[1]);
" Q& H) w2 q& r8 r* G6 L if ($ismoretag2[0] != "more") {8 b* x! s) J" m* H; T8 r
echo $paragraphcut[0];
1 A4 o! ]9 ]0 z% W& o% p echo $lpa_post_ending;5 d" f$ L8 O, @! Y* V5 L
if ($lpa_post_linktext != ""){
- Z8 N5 C- O8 n& J2 }1 a$ a //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";
w5 R' G p& R* ?6 I* k echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";
) K$ Q8 D( O8 o' t& H/ c' c0 h# s8 C6 E9 v }! A: f O. \) Y2 W$ d; ` `
echo "</p>";
D( N7 U* b8 B- ^! D' L, t }( [) v }& ?! M0 t
else {+ _# B1 H# {: [. ~8 Q8 k# W
return $content;
) I' G4 M) B1 F, z8 `; c }8 n+ A4 i( s3 D4 v# C
}
! E6 h3 ]2 a$ W, L, ? c else {
8 V# t$ Y6 B) f+ o return $content;
+ c% @$ k/ F' W6 {9 v$ E }
6 q' c4 C, R8 q+ Y- K- c% Q; B! P
" z& _2 ]4 D" x v& V3 Z}
' r4 s2 t5 g Wadd_filter('the_content','lpa_replace_content'); |