本帖最後由 諾基亞 於 2011-10-3 09:48 編輯
& ]* @5 {7 J! h* F9 B3 h3 z5 C$ t0 x3 B3 v6 r' c- _1 l8 B" z
我看了下,覺得寫得很一般啊。代碼混亂,特別是function.php裡面
; w5 C0 n% N' N4 y' [7 a p: d! y/ ^0 h4 w
如果要用,
]3 D. m1 _3 Z* w: z9 ]打開index.php
$ J1 e. b8 l' Y; f( o# k& n$ Q; [* n7 F9 ~
& X2 t* I! W* M5 j- `% C, v8 v
找到<div class="intro">) A1 l" _ O* m2 c b
<?php if(is_category() || is_archive() || is_home() ) {
! y% J+ B8 H& x the_excerpt();
1 ?& a0 ^# ^; n } else {( j y$ m8 o% w% ]
the_content('Read the rest of this entry »'); & T1 b I' K! X. o, ~6 G5 z. l
}
d8 K- [* r; p* F* Q ?>
0 C/ l3 D' h5 b7 i s- o& v' W </div>; a F+ y$ f! }2 P5 H# ?
4 v. ^4 N3 H, ?6 {6 [, t3 s
修改成& Q) b9 Q) s8 D$ Y% M9 m: u7 G
<div class="intro">
7 e2 `- J; p1 X% f7 l3 G7 [ <?php the_content();
) `2 x: ?! U6 U" c( D* ^ ?>( @! d" @/ a0 Z) l8 e3 ]( b( R, j
</div>4 V5 a: J( t3 G' m" w6 P
$ X. d2 u9 Y; O% N! w( D& l/ L
K! k( G5 X9 n/ _- _$ W3 r
* F( D# k3 t, D' a7 u8 E打開function.php,找到最後,刪除: j6 \3 J, W* V2 o1 ?# M2 H* m. q
9 G) `6 A* s, t4 A3 J' dfunction lpa_replace_content($content)
6 Q1 ]; y" E. i( [; `3 S{
D& n: ~' {4 n7 t5 d5 d4 V+ I. v // Get data from database
# b1 F' \9 u; w* x n) f! H) D $lpa_post_wordcut = get_option("lpa_post_wordcut");
5 p, b6 I0 [9 T4 i8 A, x- M
9 K9 B5 z' X% b9 O- o' A% k $lpa_post_letters = get_option("lpa_post_letters");. ^. c- i" R- N) ?$ j
$lpa_post_linktext = get_option("lpa_post_linktext");, I6 A3 N: z) U, \2 j4 P5 @
$lpa_post_ending = get_option("lpa_post_ending");2 I3 {) B4 D5 m8 y. j- {
5 p4 t$ G; _. w5 y, ~* `7 _ $lpa_post_home = get_option("lpa_post_home");- [/ l' G" G/ n7 M/ Z5 d. i
$lpa_post_category = get_option("lpa_post_category");. S4 w2 Z7 T; ]$ f" w! H
$lpa_post_archive = get_option("lpa_post_archive");2 b) h6 N7 A* J* n
$lpa_post_search = get_option("lpa_post_search");' g$ f0 B1 l6 o
$lpa_striptags = get_option("lpa_striptags");$ b" u/ @1 R6 W7 A- T1 O5 t4 o
5 ^3 I0 q* ]( Q+ g% r6 H // If post letters are not set, default is set to 300
) T) A' M/ S6 Y8 ]* U if ($lpa_post_letters == ""){
2 _/ U& k7 Y7 J1 z I! M $lpa_post_letters = 300;
) K. b' b4 e" H/ B }
# k; r# T4 v; y! w3 B; W5 \1 P if ( is_home() || is_category() || is_archive() || is_search() ) {" }$ [2 e+ `1 k; W# J, `2 `8 T2 ^
8 ?5 `9 C( T3 Z/ |8 v* n# y6 P
$paragraphcut = explode('</p>', $content);/ I9 s* n: }+ W8 I; b
global $post;) o# x. d8 e5 c( i& U! {
$ismoretag = explode('<!--',$post->post_content);
# z% [ i9 L; B7 E( y $ismoretag2 = explode('-->', $ismoretag[1]);
- [0 E. E# K' F if ($ismoretag2[0] != "more") {9 {0 H6 \- R8 Y- Z3 ^2 H! B: x
echo $paragraphcut[0];
1 t6 L$ l# C9 G% u6 K echo $lpa_post_ending;
* j+ {' |5 F* d) C/ Z/ ~) i if ($lpa_post_linktext != ""){
' e. P5 ^. X/ m" J) }3 ]2 f //mark080717 echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";9 I% f- l1 z- ]' _4 O
echo "<a href='" .get_permalink(). "' rel=\"nofollow\">".$lpa_post_linktext."</a>";3 B5 P# \' M R& y6 B9 g
}
) ~2 P" j8 X2 p$ U5 D, g echo "</p>";) M n) y, i8 u
}
' x0 ?. X/ d9 E8 X else {: b! p, J% R6 i3 j; r: a! |
return $content;/ ^9 ^5 f" `+ M+ R J7 D
}
# B+ ?. V, p9 I# n% l$ y. e }
8 n+ E9 ?; {1 [ else {
- o# a J3 ^7 W* x: {( m( W1 ^! d: T return $content;# X4 P1 u) Y7 f1 x3 O, z9 f
}. p( H$ n: M& R I0 t( c2 [; }6 G
' Y6 ~' ?3 V' D4 B
}
, \( u' J" {; t6 I9 w) w7 zadd_filter('the_content','lpa_replace_content'); |