本帖最後由 諾基亞 於 2011-10-3 09:48 編輯 3 m+ N6 s @! p ~1 j
) C9 L* q- b3 W& }$ y6 p
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面
3 @2 q9 l6 D$ Z; N* T) c# D9 `( D. Y" Y, T. B( E
如果要用,$ f! K) x) g% i: D" }- t- C ^
打開index.php
. a6 E) ?" p5 d) m: a% L8 @$ L
) O2 i- \8 c% `# y找到<div class="intro">& U8 U/ H! s0 a9 Z s# e
<?php if(is_category() || is_archive() || is_home() ) {5 h+ i3 j- B$ e% [
the_excerpt();6 @& j$ u. S0 U4 P$ r
} else {% B+ w; c* ~! B
the_content('Read the rest of this entry »'); * J% r4 c. t# H# P
} ; r. a/ A( x) T$ P
?>$ E. q R* G R# M7 L0 ^: ~& _6 p$ R
</div>- ^( r2 }. U4 e
3 m8 M; @! y( y$ E! f5 u修改成
( K" @8 m, h" J0 s7 |% k<div class="intro">
, O$ T! d# N8 f) F3 u4 H <?php the_content();
4 b: F+ o% @+ H. r! {2 c3 T1 R ?>
% n* \, h; Y" l% I4 C0 t- K </div>( P& K3 s) k/ t8 r3 u
, c3 D1 `. O) K! `& x! N
1 V- q7 \ [" _* ^8 K- x+ F- |2 ^9 E8 a* S! G2 T
打開function.php,找到最後,刪除
3 w! U$ c% T8 X2 G, P5 m, Y& [
# d; U7 r9 _, b. V# [+ e0 D$ p# Ffunction lpa_replace_content($content)
, s8 D; v6 R5 j1 d' g' L{
A5 i+ f/ L% }5 ] // Get data from database; b' k4 t* Z! |4 h8 z- ~6 g
$lpa_post_wordcut = get_option("lpa_post_wordcut");
" n% w! Z/ z! Y' p
. @/ ~& y( u8 N! S" J9 { $lpa_post_letters = get_option("lpa_post_letters");; b6 @3 @* l4 e1 C& |
$lpa_post_linktext = get_option("lpa_post_linktext");1 F6 z( n" S" f% `& \" C' L
$lpa_post_ending = get_option("lpa_post_ending");
0 L2 |7 j; P! J+ l/ a
0 a% _& r' K& w0 W5 k9 W8 h( a; A $lpa_post_home = get_option("lpa_post_home");: ^2 c' s' W2 ^ _/ G7 _
$lpa_post_category = get_option("lpa_post_category");9 j( l/ p+ l5 w1 t/ X: J
$lpa_post_archive = get_option("lpa_post_archive");# m3 i7 |, k) c1 v0 p7 y
$lpa_post_search = get_option("lpa_post_search");
8 H) ]! Y6 e+ ?0 m2 O7 [ $lpa_striptags = get_option("lpa_striptags");8 D' L5 Q9 u! |6 [: h# f) \
c" y" V0 W0 v& C4 }
// If post letters are not set, default is set to 300- v8 J* s" ]4 P
if ($lpa_post_letters == ""){- Y! s) h7 _( w1 J
$lpa_post_letters = 300;
4 S) y% C" w; _7 ]% ]& c }
, w3 [# l. ~9 I9 A! Z if ( is_home() || is_category() || is_archive() || is_search() ) {: y6 g7 O* m7 a; s ^
* Q b c& c- F
$paragraphcut = explode('</p>', $content);! ^' b) R$ W |) t
global $post;9 R3 a& c: K0 u) A7 B+ G0 } [
$ismoretag = explode('<!--',$post->post_content);
2 N# N3 e3 m* o $ismoretag2 = explode('-->', $ismoretag[1]);
/ N) w8 ]( [4 k: e% M { if ($ismoretag2[0] != "more") {
; D( D1 y4 N5 j! I( A echo $paragraphcut[0];
2 _% Z$ G5 ~- y" b. T3 D! c echo $lpa_post_ending;# E6 X. ~1 d6 ^
if ($lpa_post_linktext != ""){
; ]) \! }7 [0 a6 H& t //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";7 U7 P4 q4 }2 Q
echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";
$ ]7 t; ^3 n9 f7 x: _ }7 Z! |( `# e6 {% ^" m
echo "</p>";, [* ~2 \# i' i& K7 q5 R3 e
}- G( W4 R/ k+ P i/ H4 x2 g
else {* N8 p2 H6 b! K$ ^3 j) n& S
return $content;: B( P+ y. ]+ X9 _
}
- H$ A. `) R x }$ n( i6 S1 J% {3 @
else {
& k& @+ N$ o1 r9 N return $content;
3 k( ]8 _, _9 q. Q9 C }4 ` G1 z- g" W) {9 H! U) d
1 T' u- E/ b5 ^$ ]. y/ N0 m
}
/ t8 l3 t# g, H1 v Y! Iadd_filter('the_content','lpa_replace_content'); |